K0lb3 / UnityPy

UnityPy is python module that makes it possible to extract/unpack and edit Unity assets
MIT License
761 stars 113 forks source link

'int' object has no attribute 'UsesAssetBundleEncryption' #193

Closed SamueleD78 closed 8 months ago

SamueleD78 commented 12 months ago

If i try to extract a file using the examples provided on the website, i get the error in the topic:

python3.11 test.py 
Traceback (most recent call last):
  File "/home/samuele/frida/ios/extractor/test/test.py", line 44, in <module>
    unpack_all_assets(".", ".")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/frida/ios/extractor/test/test.py", line 11, in unpack_all_assets
    env = UnityPy.load(file_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/__init__.py", line 8, in load
    return Environment(*args, fs=fs, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/environment.py", line 46, in __init__
    self.load_file(arg)
    ^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/environment.py", line 127, in load_file
    f = ImportHelper.parse_file(
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/helpers/ImportHelper.py", line 138, in parse_file
    f = files.BundleFile(reader, parent, name=name, is_dependency=is_dependency)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/files/BundleFile.py", line 42, in __init__
    m_DirectoryInfo, blocksReader = self.read_fs(reader)
                                    ^^^^^^^^^^^^^^^^^^^^
  File "/home/samuele/.local/lib/python3.11/site-packages/UnityPy/files/BundleFile.py", line 112, in read_fs
    if self.dataflags & self.dataflags.UsesAssetBundleEncryption:
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'UsesAssetBundleEncryption'
samuele@DESKTOP-SAMU:~/frida/ios/extractor/test

UnityPy version is the latest, 1.10.1

K0lb3 commented 11 months ago

The issue is pretty weird, as self.dataflags can't be an int anymore at that point. see BundleFile.py#L102

The issue might be related to a possible change to the IntEnum class in Python 3.11.