Last active
August 29, 2015 14:24
-
-
Save guysmoilov/d8013650213c662f4e70 to your computer and use it in GitHub Desktop.
Get number of methods in a dex file contained in an apk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
import sys | |
def methods_in_dex(dex_bytes): | |
return int.from_bytes(dex_bytes[88:92], byteorder='little', signed=False) | |
def methods_in_apk(apkfile, dexfile='classes.dex'): | |
with zipfile.ZipFile(apkfile, 'r') as apkzip: | |
dex_bytes = apkzip.read(dexfile) | |
return methods_in_dex(dex_bytes) | |
if __name__ == "__main__": | |
print(methods_in_apk(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment