环境准备
- NRF52832 USB Dongle
- Wireshark
- nrf_sniffer_for_ble
- Python3.x
nrf_sniffer_for_ble 安装
https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le
nRF Sniffer for Bluetooth LE
The nRF Sniffer for Bluetooth® LE is a useful tool for learning about and debugging Bluetooth Low Energy applications. It provides a near real-time display of Bluetooth packets that are sent between a selected Bluetooth Low Energy device and the device it is communicating with, even when the link is encrypted.
- nrf_sniffer_for_ble 解压后的目录:
- 切换目录到 extcap 下进行相关依赖安装,主要是安装 pyserial;
pip3 install -r requirements.txt
- 打开Wireshark,帮助 –> 关于Wireshark –>文件夹,将下载好的
nrf_sniffer_for_bluetooth_le_3.1.0_7cc811f\extcap
下的所有文件拷贝到Global Extcap path
所示的文件夹内。
并检查拷贝进去的文件是否能够正常的运行,尝试运行nrf_sniffer_ble.bat
脚本,因为这也关系到接下来使用 Wireshark 是否能够正常的调用相关文件,正常运行如下图所示。
PS C:\mine\mysoftware\wireshark\extcap> .\nrf_sniffer_ble.bat --extcap-interfaces
extcap {version=3.1.0}{display=nRF Sniffer for Bluetooth LE}{help=https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE}
interface {value=COM3}{display=nRF Sniffer for Bluetooth LE COM3}
control {number=0}{type=selector}{display=Device}{tooltip=Device list}
control {number=1}{type=string}{display=Passkey / OOB key}{tooltip=6 digit temporary key or 16 byte Out-of-band (OOB) key in hexadecimal starting with '0x', big endian format. If the entered key is shorter than 16 bytes, it will be zero-padded in front'}{validation=\b^(([0-9]{6})|(0x[0-9a-fA-F]{1,32}))$\b}
control {number=2}{type=string}{display=Adv Hop}{default=37,38,39}{tooltip=Advertising channel hop sequence. Change the order in which the siffer switches advertising channels. Valid channels are 37, 38 and 39 separated by comma.}{validation=^\s*((37|38|39)\s*,\s*){0,2}(37|38|39){1}\s*$}{required=true}
control {number=3}{type=button}{role=help}{display=Help}{tooltip=Access user guide (launches browser)}
control {number=4}{type=button}{role=restore}{display=Defaults}{tooltip=Resets the user interface and clears the log file}
control {number=5}{type=button}{role=logger}{display=Log}{tooltip=Log per interface}
value {control=0}{value= }{display=All advertising devices}{default=true}
- 接下来是在 Wireshark 导入 BLE 相关 profile,这样 Wireshark 才能够解析 BLE 的数据包。同样的也是打开配置文件夹将相关文件导入到个人配置所指示的文件夹中,将
nrf_sniffer_for_bluetooth_le_3.1.0_7cc811f\Profile_nRF_Sniffer_Bluetooth_LE
文件夹拷贝到下述的个人配置路径的 profiles 文件夹即可。
- 刷新接口使能 nrf_sniffer tool;
BLE 抓包
选择 nRF Sniffer Bluetooth LE 接口
参考链接:
https://blog.csdn.net/qq_33475105/article/details/115058045