import zipfile, re, io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
APK = r'E:\ios\vf_apk\com.vinfast.companion.app.apk'
z = zipfile.ZipFile(APK)
data = z.read('resources.arsc')
# chuỗi UTF-16LE decode toàn bộ
s = data.decode('utf-16-le', errors='ignore')
print('== google_keys / project / tenant strings trong resources.arsc ==')
pats = [r'[A-Za-z0-9\-_ ]*google[_\-]?app[_\-]?id[A-Za-z0-9\-_ ]*',
        r'1:\d+:android:[a-f0-9]+',
        r'AIza[A-Za-z0-9_\-]+',
        r'[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+\.appspot\.com',
        r'projects/[a-zA-Z0-9\-]+',
        r'[A-Za-z0-9\-_ ]*google[_\-]?api[_\-]?key[A-Za-z0-9\-_ ]*',
        r'default_web_client',
        r'firebase',
        ]
for p in pats:
    hits = sorted(set(re.findall(r'(?i)' + p, s)))
    for h in hits[:8]:
        print(f'    [{p[:20]:20s}] {h[:120]}')
# và cả strings UTF-8 plain
s8 = data.decode('utf-8', errors='ignore')
print('\n== plain UTF-8 (fallback) ==')
for pat in [r'AIza[A-Za-z0-9_\-]+', r'1:\d+:android:[a-f0-9]+', r'google_api_key']:
    for h in sorted(set(re.findall(pat, s8)))[:6]:
        print('   ', h)
