ubireader&nanddump tools安装
ubifs镜像分析,可以借助相应工具。
sudo apt install python3-pip
UBIReader
https://github.com/onekey-sec/ubi_reader/tree/main/ubireader
https://github.com/TinyNiko/ubi_reader_rust
UBIFS镜像分析,UBI read, UBI dump
pip install --user ubi_reader
vim .bashrc 添加 export PATH=$PATH:~/.local/bin
ubi_reader需要依赖python-lzo pip install --user python-lzo 安装时构建wheel报错:
Building wheels for collected packages: python-lzo
Running setup.py bdist_wheel for python-lzo ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-6tq5axea/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-_z6ku6oq --python-tag cp37:
lzomodule.c: In function ‘compress’:
lzomodule.c:121:13: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare]
if (len > LZO_UINT_MAX) {
^
lzomodule.c:126:35: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare]
if ((len + len / 16 + 64 + 3) > LZO_UINT_MAX) {
^
lzomodule.c: In function ‘optimize’:
lzomodule.c:453:44: warning: pointer targets in passing argument 1 of ‘PyBytes_FromStringAndSize’ differ in signedness [-Wpointer-sign]
result_str = PyBytes_FromStringAndSize(in, len);
^~
In file included from /usr/include/python3.7m/Python.h:98,
from lzomodule.c:36:
/usr/include/python3.7m/bytesobject.h:51:24: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
^~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
lzomodule.c:577:25: warning: ‘module_documentation’ defined but not used [-Wunused-variable]
static /* const */ char module_documentation[]=
^~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /usr/lib/liblzo2.a(lzo1b_1.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo1c_1.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo1x_9x.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo1y_9x.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo1z_9x.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo_crc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/liblzo2.a(lzo_util.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链结失败: nonrepresentable section on output
collect2: error: ld returned 1 exit status
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
Failed building wheel for python-lzo
需要为系统安装lzo依赖:
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
tar -xvzf lzo-2.10.tar.gz
cd lzo-2.10
./configure --enable-pic --enable-shared
make
sudo make install
sudo cp /usr/local/lib/*lzo* /usr/lib
nanddump tool
git clone https://github.com/SySS-Research/nand-dump-tools.git
pip install bchlib
./nand_dump_decoder.py --help