-
-
Notifications
You must be signed in to change notification settings - Fork 159
Update BundleFile.py #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update BundleFile.py #345
Conversation
Fix CN bundle decrypt : The wrong block was decrypted only LZ4HC need decrypt
Do you have enough evidence to prove this? @AniccaY Although LZ4HC compression flag is widely used in many UnityCN-encrypted games, we cannot draw a conclusion that LZ4HC flag is used in ALL the UnityCN-encrypted games. |
old version will decrypt type: None Block, cause read bundle error |
I'm interested in the asset file you try to decrypt. Could you please provide a sample file and its key to let me investigate deeper? |
sample.zip |
Thanks. In your sample files, the blocks with compression flag NONE need no decryption. In another word, for NONE compression, UnityPy should return the data as-is without decryption. I think you can use: if self.decryptor is not None and comp_flag != CompressionFlags.NONE and flags & 0x100:
... instead of simply limiting the decryption to LZ4HC only. As you can see in Studio's implementation, such decryption is applied to all the LZ4-series compression. Here's the reference. |
Fix CN-Bundle decrypt
UnityPy/files/BundleFile.py
Outdated
if self.decryptor is not None and comp_flag != CompressionFlags.NONE and flags & 0x100: | ||
try: | ||
compressed_data = self.decryptor.decrypt_block(compressed_data, index) | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such try-except
bypass strategy may conceal potential problems. I think we can remove it.
Btw, it's suggested to rename your PR's title to let it reflect actual works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the significance of your new changes.
Please edit the if-statement of L505 only.
Fix CN bundle decrypt :
The wrong block was decrypted
only LZ4HC need decrypt