# -*- coding: utf-8 -*-
# Tìm chuỗi liên quan command trong toàn bộ dex: messageCommand/commandType/remote
import io, sys, re, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
DEXDIR = r'E:\ios\vf_dex'
KEYS = ['messageCommand', 'commandType', 'command_type', '"vinCode"', 'remoteCommand', 'MobileCmd']
for fn in sorted(os.listdir(DEXDIR)):
    if not fn.endswith('.dex'):
        continue
    data = open(os.path.join(DEXDIR, fn), 'rb').read()
    for m in re.finditer(rb'[\x20-\x7e]{6,}', data):
        s = m.group().decode('ascii', 'replace')
        for k in KEYS:
            if k in s and len(s) < 400:
                print(fn, '|', k, '|', s[:300])
                break
