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

APK = Path(__file__).resolve().parent.parent / "apks" / "seabank_ph_base.apk"
DEXDUMP = Path(r"C:\Users\Administrator\AppData\Local\Android\Sdk\build-tools\37.0.0\dexdump.exe")

tmp = Path(__file__).resolve().parent.parent / "tmp" / "tmp11.dex"
with zipfile.ZipFile(APK) as zf:
    tmp.write_bytes(zf.read("classes11.dex"))

out = subprocess.check_output(
    [str(DEXDUMP), "-d", str(tmp)], universal_newlines=True, errors="replace"
)
for line in out.splitlines():
    if "SHPSSDK;" in line and any(
        k in line for k in ("getRisk", "assessRisk", "getRiskToken", "getExtRisk")
    ):
        print(line.strip())
