抓包进,协议出。
frames · 12 B
0123456789CHK11
AA0252CB7168727D6E5E4D55
AA021B5E2F0DF9A6A9C43D55
AA0273D144E4D1382EDD7E55
AA024B362D705E08C0487255
AA026D8AECD2943C3D9F9D55
AA02E18DAE17826151D8BF55
3 份抓包 · 帧 89,500
# Agent:接上设备,规划 3 段抓包(空闲 / 负载 A / 负载 B)
# 抓包 1/3 完成
# 抓包 2/3 完成
# 抓包 3/3 完成
$ python3 run_decode.py -i captures/ -o out/
baud 19200 (bit 52 µs · 置信 A)
frames 89,500 · 12 B · AA 02 [8 B] [CHK] 55
payload 熵 8.00 bit/B → 分组密码
ledger 42 种:试 31 · 跳过 11 · 命中 0
checksum 搜索 SUM / XOR / CRC …
checksum −Σ bytes[1..9] mod 256 → byte[10] HIT 88,901/88,901
terminal ACQUISITION_PLAN · 下一步 4 条
written protocol_spec_draft.md
协议规格 · 某电池包通讯
| 偏移 | 长度 | 字段 | 说明 |
|---|---|---|---|
| 0 | 1 | HEAD | 0xAA |
| 1 | 1 | — | 固定 0x02 |
| 2 | 8 | PAYLOAD | 加密(分组密码) |
| 10 | 1 | CHK | −Σ bytes[1..9] |
| 11 | 1 | TAIL | 0x55 |
结论
- 攻击台账:42 种(试 31 · 跳过 11)
- 抓包:3 份 · 帧 89,500
- 下一步:采集计划 4 条
- 接设备抓包Agent 在本机
- 判编码确定性程序
- 定帧格式确定性程序
- 攻校验攻击台账
- 验证负对照
- 出文档Agent 整理
每一句都有凭据
四条边界,每条都有真实产物。
42 种攻击,有台账,不是猜。
$ python -c "from attack_registry import REGISTRY as R print(len(R)); [print(a.name, a.category) for a in R[:4]]" 42 bit_bias statistical entropy_ceiling statistical duplicate_frames structural brute_force_xor cryptoscripts/attack_registry.py · 台账总数与前 4 条(2026-09-24 实跑)
负对照不亮,才算解开。
$ pytest scripts/tests/test_attack_validator.py -v TestChecksum::test_random_fails PASSED TestValidateDecryption::test_random_in_random_out_rejected PASSED TestValidateDecryption::test_wrong_xor_key_rejected PASSED TestValidateDecryption::test_correct_decryption_confirmed PASSEDscripts/tests/test_attack_validator.py · 随机输入与错误密钥必须被拒(2026-09-24 实跑,12 项全过)
真设备的数据,打出过合成数据打不出的坑。
CHANGELOG 10.12.0 · First run against real device captures Baud detection took the leftmost peak instead of the dominant one. The charger captures were detected at 21164 baud with confidence "A"; decoding at the true 19200 dropped framing errors from 4484 to 2 and from 10364 to 0.CHANGELOG.md · 10.12.0(2026-08-18)
每一步可复跑。
$ pytest scripts/tests -q … scripts/tests/test_v10_contracts.py ............................ [ 99%] scripts/tests/test_version_consistency.py .. [100%] 412 passed in 95.04sscripts/tests · 全量测试(2026-09-24 实跑)
三步到位
- 01接入你们的设备与抓包格式
- 02用你们的一台设备跑通
- 03产线交付与培训