Figure out where the first lzma data will start...

Not sure what is inside these other bits...offsets? lengths? crc?
who knows..
This commit is contained in:
Holger Hans Peter Freyther 2016-12-13 11:58:50 +01:00
parent bcdfcb62a9
commit 45d7e599ec
2 changed files with 26 additions and 1 deletions

View File

@ -6,6 +6,12 @@ for general information. This is a script to dissect and maybe
re-assemble the system.diff file. Let's see how far we get.
After the header is a table of data.. before the first LZMA
compressed update. The size of that area seems to be computed
as:
8 * num_diffs (maybe two CRC32?)
4 * num_insert (maybe a single CRC32)?
followed by lzma
0x0000d084 in is_expected_sig ()

View File

@ -8,6 +8,7 @@ import sys
import struct
import io
import binascii
import lzma
from PyCRC import CRC32
# initialize the tables once
@ -94,7 +95,25 @@ lzma now?
print("Delta Info: num_link - %d" % num_link)
print("Delta Info: num_critical_update - %d" % num_cupd)
print("Delta Info: num_critical_insert - %d" % num_cins)
#print(hexstring(upd_dat))
# dump it temporarily
d = rstr.read()
with open("foo.bin", "wb") as f:
f.write(d)
# parse the index area...
rstr = io.BytesIO(d)
idx_len = (8 * num_diff) + (4 * num_inse)
idx = rstr.read(idx_len)
assert len(idx) == idx_len
# decompress that file table...
compr = lzma.LZMADecompressor()
d = compr.decompress(rstr.read())
print(d)
print(hexstring(compr.unused_data))
# XXX... how long is the _rest_ how to index
# Parse the chunk..
checksum = rstr.read(4)