# -*- coding: utf-8 -*-
import zipfile
from pathlib import Path

APK = Path(__file__).resolve().parent.parent / "apks" / "maribank_sg_base.apk"
needles = [
    b"The system is currently unavailable",
    b"dfp is empty",
    b"getDfp",
    b"preCheck",
    b"register",
    b"Sign up with mobile",
    b"msg_ekyc_singpass_service_error",
    b"general_error",
    b"GlobalAuth",
]
with zipfile.ZipFile(str(APK)) as zf:
    bundles = [n for n in zf.namelist() if n.endswith(".jsbundle")]
    print("bundles:", len(bundles))
    for name in bundles:
        data = zf.read(name)
        hits = [n.decode() for n in needles if n in data]
        if hits:
            print(name, hits)
