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:
![](/proxy.php?image=https%3A%2F%2Fi.ibb.co%2FHPbyg7z%2Fimage.png&hash=ba24f4d2a4defb93677a54503cdac696)
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:
![](/proxy.php?image=https%3A%2F%2Fi.ibb.co%2FYyxWQX5%2Fimage.png&hash=9645c427183c6238dd2626f8e4691873)
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>
![](/proxy.php?image=https%3A%2F%2Fi.ibb.co%2FKmFWzKq%2Fimage.png&hash=ecad6ab6029b41450f23dd8dcdc753bf)
[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>
![](/proxy.php?image=https%3A%2F%2Fi.ibb.co%2FTt5vY6X%2Fimage.png&hash=5fb309ecf8f2eeffa54af7376374b508)
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>
![](/proxy.php?image=https%3A%2F%2Fi.ibb.co%2FN9Sq7MM%2Fimage.png&hash=00908742491f6616904cea194177e527)
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.