-
-
Save 1trackprojects1/bbffd67e1a371962de0548f2cbacf125 to your computer and use it in GitHub Desktop.
get dex MD5 of WhatsApp Application and get WhatsApp Version from an APK file
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
#!/usr/bin/env python3 | |
# tweak up from https://github.com/mgp25/classesMD5-64/blob/master/dexMD5.py | |
# build AXML library from https://github.com/kin9-0rz/apkutils | |
# add xml manifest parse for getting WhatsApp Version | |
# to use this $ python3 dexMD5.py apk/WhatsApp.apk | |
# Output : | |
# WhatsApp Version : 2.17.296 | |
# WhatsApp ClassesDEX MD5 : b'YrJNPljM3TuNFPIOZ+jziw==' | |
# | |
# @MasBog | |
import sys | |
import zipfile | |
import hashlib | |
import base64 | |
from xml.dom import minidom | |
from apkutils import AXML | |
try: | |
apkName = sys.argv[1] | |
zipFile = zipfile.ZipFile(apkName,'r') | |
hash = hashlib.md5() | |
hash.update(zipFile.read('classes.dex')) | |
axml = AXML(zipFile.read('AndroidManifest.xml')) | |
xml = minidom.parseString(axml.get_buff()) | |
package = xml.documentElement.getAttribute("package") | |
print("--> WhatsApp Version : "+xml.documentElement.getAttributeNS('http://schemas.android.com/apk/res/android', "versionName")) | |
print("--> WhatsApp ClassesDEX MD5 : "+ str(base64.b64encode(hash.digest()))); | |
except: | |
print("Please enter directory of WhatsApp.apk") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment