Androguard - 庞大的 APK 分析导致错误“MemoryError”

Androguard - huge APK analysis resulting in error `MemoryError`

我一直在尝试使用 Androguard 来分析 APK 文件。 我的代码很简单:

from androguard import misc
from androguard import session

APK_TO_ANALYZE_PATH = r"file.apk"

a, d, dx = misc.AnalyzeAPK(APK_TO_ANALYZE_PATH)
print(" [*] Success")

A​​PK 文件很大,压缩后大约 150MB。但是,我的机器有 16GB 的内存,页面文件定义为最大 14GB,所以我总共有 30GB 的内存。

在尝试分析这个巨大的 APK 时,几分钟后我收到错误消息:

Traceback (most recent call last):
  File "C:\Projects\ApkFiles\apk_analyzer.py", line 48, in <module>
    main()
  File "C:\Projects\ApkFiles\apk_analyzer.py", line 39, in main
    a, d, dx = misc.AnalyzeAPK(APK_TO_ANALYZE_PATH)
  File "C:\Python37-32\lib\site-packages\androguard\misc.py", line 69, in AnalyzeAPK
    for dex in a.get_all_dex():
  File "C:\Python37-32\lib\site-packages\androguard\core\bytecodes\apk.py", line 808, in get_all_dex
    yield self.get_file(dex_name)
  File "C:\Python37-32\lib\site-packages\androguard\core\bytecodes\apk.py", line 771, in get_file
    return self.zip.read(filename)
  File "C:\Python37-32\lib\zipfile.py", line 1432, in read
    return fp.read()
  File "C:\Python37-32\lib\zipfile.py", line 885, in read
    buf += self._read1(self.MAX_N)
  File "C:\Python37-32\lib\zipfile.py", line 975, in _read1
    data = self._decompressor.decompress(data, n)
MemoryError

有什么问题?

使用 python x64 解决了问题。