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

APK = r"C:\Users\Administrator\Desktop\notiMessage\reverse\apks\seabank_ph_base.apk"
TARGETS = [b"isXposed", b"isRooted", b"checkRoot", b"isRoot", b"isEmulator", b"jailbroken"]

with zipfile.ZipFile(APK) as zf:
    for dex_name in ["classes6.dex", "classes9.dex", "classes15.dex", "classes3.dex"]:
        data = zf.read(dex_name)
        print("=== %s ===" % dex_name)
        for needle in TARGETS:
            if needle not in data:
                continue
            idx = 0
            shown = 0
            while shown < 8:
                i = data.find(needle, idx)
                if i < 0:
                    break
                s = max(0, i - 80)
                e = min(len(data), i + 80)
                chunk = re.sub(rb"[^\x20-\x7e]+", b" ", data[s:e]).decode("ascii", "ignore")
                if "shopee" in chunk.lower() or "seabank" in chunk.lower() or "bke" in chunk.lower() or "alc" in chunk.lower():
                    print(" ", needle.decode(), "->", chunk.strip())
                    shown += 1
                idx = i + 1
        print()
