1

Hello i'm trying to unpack file Download.img from alcatel mw40 (based on qualcomm 9x07) firmware but it seems i can't do it with 7zip or mount the img file . someone already extracted the file which will give partition images like this :

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

under linux the format of the file is :

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

anyone can show how to unpack this file to get the list of mentioned files above thanks for help , i'm trying to learn how. file link Download.img

1

run code.py Download.img to test the code

import os
import sys
import struct

if len(sys.argv) <= 1 :
    print('usage: %s file' % sys.argv[0])
    exit(1)

path = '%s.out/' % 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
        v = struct.unpack('LL', f.read(0x08))
        f.seek(v[0])
        out = open('%s%s' % (path, name), 'wb')
        out.write(f.read(v[1]))
        out.close()
        i += 1
    f.close()
  • Hi Thanks for your answer , i'm getting this error : python code.py Download.img Traceback (most recent call last): File "code.py", line 20, in <module> v = struct.unpack('LL', f.read(0x08)) struct.error: unpack requires a string argument of length 16 – coolirc Jul 27 at 10:13
  • also if i add a print(f) right after name = ... and after v = struct.unpack i get same value : the output of print(f) is same twice <open file 'Download.img', mode 'rb' at 0x7fda9c519780> <open file 'Download.img', mode 'rb' at 0x7fda9c519780> – coolirc Jul 27 at 15:46
  • Thanks actually i tried the script on a windows machine with python version 2.7 and this script actually worked as expected , i don't know why it did not work on linux ubuntu machine , maybe the python version is not compatible i'll look for it later . thanks – coolirc Jul 27 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.