executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
re-iot-proto物联网协议:MQTT/CoAP/BLE/Zigbee;BLE 链路层(广播解析/配对加密)与 NFC/智能卡(ISO14443/APDU/MIFARE)。 触发词:MQTT、CoAP、BLE、Zigbee、物联网协议、IoT协议、BLE链路、BLE嗅探、广播解析、配对加密、GATT、NFC、智能卡、MIFARE、APDU、ISO14443
Independent GitHub snapshot · Automated classification · Original documentation governs
物理设备抓包注意授权边界(见步骤 5),动态场景默认沙箱 / 隔离网络([[re-analyze/platform-tips]] 最高原则)。所有工具先验证再使用。
apt install wireshark tshark / dnf install wireshark-cli wireshark / pacman -S wireshark-cli wireshark-qt(Arch 已拆分为 wireshark-cli + wireshark-qt;Debian 安装时选"允许非 root 抓包",或 sudo dpkg-reconfigure wireshark-common 后把用户加入 wireshark 组)brew install --cask wireshark(含 tshark CLI;或 brew install wireshark 仅 CLI)choco install wireshark;WSL 内用 Linux 版tshark --version;tshark -G fields | grep -iE 'mqtt|coap|btatt|zbee' 列出字段名(各版本字段名有微调,以该输出为准)pip install scapy(Python 3)python3 -c "import scapy; print(scapy.__version__)"apt install mosquitto-clients(mosquitto_pub / mosquitto_sub)dnf install mosquitto;Arch: pacman -S mosquitto;macOS: brew install mosquitto;Windows: choco install mosquittomosquitto_pub -h;mosquitto_sub -hapt install libcoap3-bin(提供 coap-client)dnf install libcoap libcoap-utils(coap-client 位于 libcoap-utils 子包);Arch: pacman -S libcoap(extra);macOS: brew install libcoappip install aiocoap(命令 aiocoap-client,Python 3)coap-client -h(或 aiocoap-client -h)apt install bluez;Fedora dnf install bluez;Arch pacman -S bluez bluez-utils;验证 btmon --helpapt install ubertooth(固件另装 ubertooth-firmware);Fedora dnf install ubertooth(Fedora 43/44 官方仓库有);Arch 官方仓库无 → AUR;macOS brew install ubertooth;验证 ubertooth-btle -sadb bugreport 或拉取 /sdcard/btsnoop_hci.log(btsnoop 格式,Wireshark 直接打开)pip3 install killerbee(PyPI;依赖 libusb/libpcap——Debian/Ubuntu apt install libusb-1.0-0-dev libpcap-dev、Fedora dnf install libusbx-devel libpcap-devel、Arch pacman -S libusb libpcap);固件烧写 sudo ./kb_install_firmware;验证 kb --version按顺序执行,每步产物(pcap / 密钥 / 解析脚本 + sha256)存档。
tshark -r cap.pcap -q -z io,phs # 协议分层统计
tshark -r cap.pcap -T fields -e tcp.dstport -e udp.dstport | sort | uniq -c | sort -rn
tshark -d tcp.port==9999,mqtt 强制指定tshark -r cap.pcap -Y mqtt -T fields -e mqtt.topic -e mqtt.msg
tshark -r cap.pcap -Y 'mqtt.topic contains "ota"' -T fields -e mqtt.msg # 按主题过滤
tshark -r cap.pcap -Y coap -T fields -e coap.code -e coap.uri_path -e coap.opt.content_format
device/<id>/sensor、ota/update、cmd/relay 等——先按 topic 分桶(-e mqtt.topic | sort | uniq -c)mosquitto_sub -h <broker> -t '#' -v(全量订阅)、mosquitto_pub -h <broker> -t <topic> -m '{"relay":1}';coap-client -m get coap://<ip>/sensor、coap-client -m put -e '{"on":1}' coap://<ip>/relaybtsnoop_hci.log 用 Wireshark 打开(自动解 HCI)btmon -w out.btsnoop(配合目标连接过程;写出的 btsnoop 格式 Wireshark 直接打开)ubertooth-btle -f -c 0(follow 模式观察广播 / 连接包)、ubertooth-btle -s(扫描)——实时显示不落盘,配合屏幕分析;要落盘进 Wireshark 用 btmon / Android btsnoop / nRF Sniffer(extcap)tshark -r ble.pcap -Y btatt -T fields -e btatt.opcode -e btatt.uuid -e btatt.value
ZigBeeAlliance09)zbgoodfind 在固件里找密钥)④ 物理访问协调器读配置tshark -r zigbee.pcap -Y zbee_zcl -T fields -e zbee_zcl.cmd 看命令(字段名以 tshark -G fields | grep -i zbee 为准)zbdump(抓包)、zbstumbler(扫网)、zbreplay(重放 ZCL 命令)ota/update 下发固件 → 截获的固件镜像可再走 [[re-firmware]]应用层之外补链路层视角:空口嗅探、广播/连接帧结构、配对加密协商与密钥定位。抓包工具底座见上文「BLE —— bluez + ubertooth」,本节侧重链路语义与深挖点。
tshark -r ble.pcap -Y btle -T fields -e btle.advertising_address -e btle.advertising_header.pdu_type -e btle.advertising_data(字段名以 tshark -G fields | grep -i btle 为准);0xFF 厂商数据段常含私有协议与设备标识,值得逐字节对照固件tshark -G fields | grep -i smp 为准)——先确认模式再决定是解密还是只看时序primary / characteristics 列出 handle ↔ UUID ↔ 属性tshark -r ble.pcap -Y btatt -T fields -e btatt.handle -e btatt.value接触式 / 无接触智能卡:ISO14443 链路、APDU 交互与常见卡族弱点。硬件用 proxmark3 类通用读写器(泛化选购),抓取/分析前确认授权边界。
hf 14a reader 类命令(proxmark3 类通用)一次输出 ATQA / UID / SAK,据此进入对应卡族工具hf 14a reader 判型 → 按卡族选攻击/读写流程 → 验证结果device/x/ota/update、cmd/relay,业务意图一目了然但 payload 加密或二进制;原因——设备常只加密 payload、topic 明文(或 broker 无 TLS);对策——topic 是语义金矿:先 -e mqtt.topic | sort | uniq -c 分桶,按 topic 定位关键流再解 payload;payload 二进制用 JSON/protobuf 假设对照固件(步骤 5)