# -*- coding: utf-8 -*- """Find jni/utils and safemode classes across SG split dex files.""" import re import zipfile from pathlib import Path APK = Path(__file__).resolve().parent.parent / "apks" / "maribank_sg_base.apk" with zipfile.ZipFile(str(APK)) as zf: for dex in sorted(n for n in zf.namelist() if n.endswith(".dex")): d = zf.read(dex) needles = [ b"Lcom/shopee/bke/lib/jni/utils/", b"Lcom/shopee/bke/lib/safemode/", b"CharacterCrypto", b"rdVerifyInfo", ] if not any(n in d for n in needles): continue print("\n===", dex, "===") for pat in [ rb"Lcom/shopee/bke/lib/jni/utils/[^;]{1,40};", rb"Lcom/shopee/bke/lib/safemode/[^;]{1,60};", rb"Lcom/shopee/bke/biz/base/risk/[^;]{1,40};", ]: cs = sorted( set( m.group().decode()[1:-1].replace("/", ".") for m in re.finditer(pat, d) ) ) for c in cs: if ".R" in c and c.endswith(".R"): continue if "$" in c or not c.endswith(".R"): print(" ", c)