Python3 脚本:解密 Unity AssetBundle 文件
以下是 Python3 脚本的实现:
import sys
import struct
def asset_bundle_simple_decrypt(file_path):
with open(file_path, "rb") as f:
bytes = f.read()
if bytes[0] == 69 and bytes[1] == 65 and bytes[2] == 66:
num = struct.unpack('<h', bytes[4:6])[0]
b = bytes[6]
for i in range(num-1, 96, -1):
bytes[i] ^= bytes[i-1]
bytes[96] = (bytes[96] ^ b)
bytes[0:8] = b'UnityFS\x00'
with open(file_path[:-3] + 'out', "wb") as f:
f.write(bytes)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python3 script.py [file_path]")
sys.exit(1)
asset_bundle_simple_decrypt(sys.argv[1])
运行方式:
python3 script.py [file_path]
其中,[file_path]是需要解密的文件路径。解密后的文件会保存在同目录下,文件名为原文件名加上".out"后缀。
原文地址: https://www.cveoy.top/t/topic/npnU 著作权归作者所有。请勿转载和采集!