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

APK = r"C:\Users\Administrator\Desktop\notiMessage\reverse\apks\seabank_ph_base.apk"
needles = [b"An error has occurred", b"-1201", b"8424 8050", b"Error --", b"killProcess", b"finishAffinity"]
with zipfile.ZipFile(APK) as zf:
    data = b"".join(zf.read(n) for n in zf.namelist() if n.endswith(".dex"))
    for n in needles:
        idx = data.find(n)
        if idx >= 0:
            ctx = re.sub(rb"[^\x20-\x7e]+", b" ", data[max(0, idx - 60): idx + len(n) + 80])
            print(n.decode(), "->", ctx.decode())
