nlitsme / ubidump

Tool for viewing and extracting files from an UBIFS image
MIT License
232 stars 60 forks source link

ERROR a bytes-like object is required, not 'int' #3

Closed himanshudas closed 7 years ago

himanshudas commented 7 years ago

Command:

username@ localhost in ~/Desktop/ubidump $ python3  ubidump.py -v -c /etc/passwd 21486C.ubi

Output (Error):

==> 21486C.ubi <==
1 named volumes found, 2 physical volumes, blocksize=0x20000

===== block =====
EC: magic=b'UBI#', v1, ec=0, vidhdr=800, data=1000, imgseq=69e6d86e  VID: magic=b'UBI!', v1, vt=1, cp=0, compat=5, volid=7fffefff, lnum=[0], dsize=0, usedebs=0, datapad=0, datacrc=0, sqnum=0
  VREC: rsvpebs=234, align=1, datapad=0, voltype=1, updmark=0, flags=1, name=b'system'
volume 7fffefff : 2 lebs
volume 0 : 234 lebs

== volume b'system' ==

*** superblock ***
SUPER: kh:0, fmt:0, flags=0, minio=2048, lebsize=0x1f000, lebcount=234, maxleb=984, maxbud=8388608, loglebs=5, lptlebs=2, orphlebs=1, jheads=1, fanout=8, lsave=256, fmt=v4, compr=2, rp=0:0, rpsize=0, timegran=1000000000, uuid=b'2898977b6e52472c9069e4b7d8476cd9', rocompat=0

*** masterblock ***
MST: max_inum=02347, cmtno=0, flags=2, loglnum=3, root=[233:0x06648], rootlen=128, gc_lnum=[228], ihead=[233:0x06800], ixsize=533960, total(free:286720, dirty:193488, used:27301480, dead:185504, dark:52328), lpt=[08:0x0049c], nhead=[08:0x00800], ltab=[08:0x004a8], lsave=[00:0x00000], lscan=[11], empty=1, idx=5, nleb=234

ERROR a bytes-like object is required, not 'int'
Traceback (most recent call last):
  File "ubidump.py", line 936, in main
    processfile(fn, args)
  File "ubidump.py", line 919, in processfile
    fs.savefile(inum, sys.stdout, args.cat)
  File "ubidump.py", line 804, in savefile
    dat = c.getnode()
  File "ubidump.py", line 728, in getnode
    return self.fs.readnode(page.branches[ix].lnum, page.branches[ix].offs)
  File "ubidump.py", line 647, in readnode
    node.parse(nodedata)
  File "ubidump.py", line 337, in parse
    self.data = decompress(data[self.hdrsize:], self.size, self.compr_type)
  File "ubidump.py", line 291, in decompress
    return unzlib(buflen)
  File "ubidump.py", line 284, in unzlib
    return zlib.decompress(data)
TypeError: a bytes-like object is required, not 'int'
nlitsme commented 7 years ago

Your patch looks good, but i can't test it. Do you have a sample file which uses zlib compression for me?

himanshudas commented 7 years ago

@nlitsme , Yeah sure, here: https://drive.google.com/file/d/0B4ijiY9P8ca3Ynl4SUh5cE5adEk/view?usp=sharing