# -*- coding: utf-8 -*-
import re
import zipfile

APK = r"C:\Users\Administrator\Desktop\notiMessage\reverse\apks\seabank_ph_base.apk"
targets = [
    b"Lcom/shopee/bke/lib/commonui/widget/CommonDialog;",
    b"Lcom/shopee/bke/lib/commonui/widget/CommonDialog$Builder;",
]
with zipfile.ZipFile(APK) as zf:
    data = b"".join(zf.read(n) for n in zf.namelist() if n.endswith(".dex"))
    for t in targets:
        print("===", t.decode()[1:-1].replace("/", "."), "===")
        idx = 0
        c = 0
        while c < 5:
            idx = data.find(t, idx)
            if idx < 0:
                break
            ctx = data[max(0, idx - 100): idx + 300]
            for m in re.finditer(rb"(show|build|create|setMessage|setContent|display)[a-zA-Z0-9_$<>]*", ctx):
                print(" ", m.group().decode())
            idx += 1
            c += 1
