Masquerade
Новичок
How to handle Unity LZMA Bundles
[Q] How do I know if a bundle is compressed with LZMA?
[A] The LZMA header will be present in the compressed bundle file:
First byte: 5D
Next 4 bytes: dictionary size
Next 8 bytes: uncompressed data size
[Q] How do I decompress this data?
[A] First, strip away all bytes before the 5D byte of the LZMA header:
Open command line and with QuickBMS, run this command:
This will generate an uncompressed file:
[Q] How do I compress this data and restore the original bundle?
[A] Download the LZMA SDK from Igor Pavlov Site. From the download, you will need lzma.exe from the bin folder.
Open a command line and run this command:
Now we have a new compressed stream, but it is missing crucial data such as the Unity header. We can make a quick patch using HDiffZ to restore the file:
As you can see, the patch file is ~210 bytes.
By using hpatchz, you can apply the patch to your compressed stream to restore the original Unity LZMA compressed bundle file.
[Q] How do I know if a bundle is compressed with LZMA?
[A] The LZMA header will be present in the compressed bundle file:

First byte: 5D
Next 4 bytes: dictionary size
Next 8 bytes: uncompressed data size
[Q] How do I decompress this data?
[A] First, strip away all bytes before the 5D byte of the LZMA header:

Open command line and with QuickBMS, run this command:
Код:
quickbms -s "comtype lzma_dynamic ; get SIZE asize ; get NAME basename ; clog NAME 0 SIZE SIZE" "" <input file>
This will generate an uncompressed file:

[Q] How do I compress this data and restore the original bundle?
[A] Download the LZMA SDK from Igor Pavlov Site. From the download, you will need lzma.exe from the bin folder.
Open a command line and run this command:
Код:
lzma e -d19 -fb64 <input file> <output_file>

Now we have a new compressed stream, but it is missing crucial data such as the Unity header. We can make a quick patch using HDiffZ to restore the file:
Код:
hdiffz <lzma compressed file> <original bundle> <patch file>

As you can see, the patch file is ~210 bytes.
By using hpatchz, you can apply the patch to your compressed stream to restore the original Unity LZMA compressed bundle file.