阿尔卡特 mw40 解包 Download.img 固件

逆向工程 固件 开箱
2021-07-06 18:51:32

您好,我正在尝试从 alcatel mw40(基于 qualcomm 9x07)固件解压缩文件 Download.img 但似乎我无法使用 7zip 或挂载 img 文件。有人已经提取了该文件,该文件将提供如下分区图像:

appsboot_fastboot.mbn
appsboot.mbn
b.vhd
config.xml
custom_info.xml
efs.mbn
ENPRG9x07.mbn
jrdresource.ubi
mdm9607-boot.img
mdm9607-sysfs.ubi
NON-HLOS.ubi
NPRG9x07.mbn
partition.mbn
rpm.mbn
sbl1.mbn
tz.mbn

linux下文件格式为:

file Download.img 
Download.img: dBase III DBT, version number 0, next free block index 65545, 1st item "D\343\006"

任何人都可以展示如何解压此文件以获取上面提到的文件列表,感谢您的帮助,我正在尝试学习如何操作。文件链接 下载.img

1个回答

文件格式由一个从 0xC8 开始的文件表组成,每个条目是:

  • 字符文件名[48]
  • uint32_t 位置
  • uint32_t 大小

whereposition表示在存档中的位置和size存档文件的大小。

运行code.py Download.img以提取文件并将它们放入Download.img.out/

from __future__ import print_function
import os
import sys
import struct

if len(sys.argv) <= 1:
    print('usage: {} file'.format(sys.argv[0]))
    exit(1)

path = '{}.out/'.format(sys.argv[1])

if not os.path.exists(path):
    os.makedirs(path)

with open(sys.argv[1], 'rb') as f:
    i = 0
    while True:
        f.seek(0xC8 + i*0x50)
        name = f.read(0x48).decode('ascii').split('\x00')[0]
        if (len(name) == 0): break
        if struct.calcsize('II') == 0x08:
            v = struct.unpack('II', f.read(0x08))
        elif struct.calcsize('LL') == 0x08:
            v = struct.unpack('LL', f.read(0x08))
        else:
            print("Unsupported platform")
            exit(1)
        f.seek(v[0])
        out = open('{}{}'.format((path, name), 'wb'))
        out.write(f.read(v[1]))
        out.close()
        i += 1
    f.close()