Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Get number of methods in a dex file contained in an apk.
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 =
return methods_in_dex(dex_bytes)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment