Files
glass/glass-mouse/scripts/_apk_scan.py
T
admin 2840e82685 Initial commit: Android GlassMouse + iOS GlassRemote 智能眼镜遥控项目
包含本次会话修复:
- iOS clickReady 警告 bug(默认 false 永远显示)
- BLE 'handle is invalid' 排查(stale handle auto-retry 实验 + 回退)

项目结构:
- glass-mouse/: 眼镜端原生 Kotlin App,前台服务 MouseService + 自定义 BLE GATT 桥接 ProxyBleServer + 无障碍 GestureDescription 注入
- ios/GlassRemote/: iPhone 端 SwiftUI + CoreBluetooth,通过 BLE 直连眼镜
- HTTP 投屏服务(:8000) 接 PPT/WPS 备注宏 POST 推送

技术栈: Android Kotlin (gradle 8.14.4, compileSdk 34), iOS Swift 5.10 (Xcode 26.5)
2026-08-26 10:34:23 +08:00

56 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
# 扫描官方 APK,寻找 0x2020 服务 UUID 与 aa55 帧构造代码
import os, re, subprocess, zipfile, io
APK = "/Users/xs/Desktop/ruoyi/glass/2.0.052-CH_79454350.apk"
TMP = "/tmp/inmo_apk_scan"
os.makedirs(TMP, exist_ok=True)
# 解压
with zipfile.ZipFile(APK) as z:
names = z.namelist()
dexes = [n for n in names if n.endswith(".dex")]
sos = [n for n in names if n.endswith(".so")]
print("dex:", dexes)
print("so :", sos)
for n in dexes + sos:
data = z.read(n)
out = os.path.join(TMP, os.path.basename(n))
with open(out, "wb") as f:
f.write(data)
def scan_file(path, label):
with open(path, "rb") as f:
data = f.read()
print(f"\n=== {label} ({len(data)} bytes) ===")
# 1) ASCII 字符串片段
for needle in [b"00002020", b"00002021", b"2020-0000", b"2021-0000",
b"aa55", b"AA55", b"0x2020", b"0x2021", b"e49a", b"BLE_UUID"]:
idx = 0
hits = 0
while True:
i = data.find(needle, idx)
if i < 0: break
hits += 1
if hits <= 3:
ctx = data[max(0,i-30):i+len(needle)+30]
try:
txt = ctx.decode("latin1")
except:
txt = repr(ctx)
print(f" [{needle.decode()}] @{i}: ...{txt}...")
idx = i + 1
if hits:
print(f" -> {needle.decode()} 命中 {hits} 次")
# 2) 裸字节 0xAA 0x55 序列(帧头)
for m in re.finditer(rb'\xaa\x55', data):
i = m.start()
if i <= 3: # 避免重复
ctx = data[i:i+24]
print(f" [RAW aa55] @{i}: {ctx.hex()}")
for n in dexes:
scan_file(os.path.join(TMP, os.path.basename(n)), "dex:"+os.path.basename(n))
for n in sos:
scan_file(os.path.join(TMP, os.path.basename(n)), "so:"+os.path.basename(n))