# -*- coding: utf-8 -*-
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:
    d = b"".join(zf.read(n) for n in zf.namelist() if n.endswith(".dex"))

classes = sorted(set(m.group().decode()[1:-1].replace("/", ".")
                     for m in re.finditer(rb"Lcom/shopee/bke/lib/safemode/[^;]{1,80};", d)))
print("safemode classes:", len(classes))
for c in classes[:30]:
    print(c)

print("\nrisk classes:")
for m in re.finditer(rb"Lcom/shopee/bke/biz/base/risk/[^;]{1,40};", d):
    print(m.group().decode()[1:-1].replace("/", "."))
