To be able to quickly build BLE5 packet capture environment, wrote this article, I hope to give a Bluetooth developers to bring some help. The following is a specific procedure. End of the article links needed to pay for the software.
First, install WireShark2.4.6
BLE Ethereal is based WireShark, other versions not verified, validated version 2.4.6 available. WinPcap must be installed. When you uninstall the original WireShark, WinPcap not deleted, so when you install the 2.4.6 version will not have to install WinPcap up. Software installation nothing to say until the next point on it.
![](https://img-blog.csdnimg.cn/20200120201553610.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
Second, the installation Python2.7
Here it must be installed Python2.7 version, measured Python3 not, have Python2.7, then there is no longer installed on the computer, but need to ensure python installation directory in the environment variable can be viewed in the console input "python -version" whether installed.
![](https://img-blog.csdnimg.cn/20200120202241852.png)
Third, the installation pyserial V3.4
If a computer with Internet access, you can enter the following command in the console: "python -m pip install pyserial", this network will automatically download pyserial. If not online, offline can be installed in accordance with the following steps.
Offline Installation: unzip pyserial-3.4.tar.gz, into the pyserial-3.4 folder in the console directory, in turn execute the command: "python setup.py build", "python setup.py install" to complete the installation. As shown below.
![](https://img-blog.csdnimg.cn/20200120202456361.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
Fourth, set up WireShark
Open Wireshark, click Help-> Folder, and then click the directory Extcap path, the open Wireshark extcap directory, or by direct installation directory Wireshark open line, as shown below.
![](https://img-blog.csdnimg.cn/20200120202804260.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
将nrfsniffer200beta312oct20181c2a221下的extcap文件夹中的内容复制到wireshark的extcap文件夹中。
![](https://img-blog.csdnimg.cn/20200120203016864.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
将nrfsniffer200beta312oct20181c2a221下的Profile_nRF_Sniffer_v2_001文件夹复制到wireshark的profiles文件夹下。
![](https://img-blog.csdnimg.cn/20200120203149443.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
五、开始抓包
到这里,环境已经搭建好了。接下来关闭Wireshark,插上nrf52832 Sniffer,这里需要安装CP210x驱动,因为这个sniffer实际上是通过USB转TTL芯片CP210x与wireshark通信的,插入sniffer后可以在设备管理器中查看是否驱动是否正常。确保驱动无误后打开Wireshark,点击下图中的nRF Sniffer即可开始抓包,如果没有出现“nRF sniffer COMx”,则可能是串口驱动没有安装正确,或者pyserial没有安装正确。
![](https://img-blog.csdnimg.cn/20200120203351907.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
最后,切换协议到之前设置的BLE协议:在Wireshark中点击Edit->Configuration Profiles…,出来以下选项,选择Profile_nRF_Sniffer_V2_001,点击OK完成设置。
![](https://img-blog.csdnimg.cn/20200120203827230.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
Sniffer默认抓取的是所有的广播包,可以在下图中Device中选择感兴趣的从机MAC地址,这样Sniffer就会只抓取该设备的数据包了。 有时候主机连上从机后,抓包工具就抓不到包了,这可能是抓包工具没有抓到跳频map,导致跟丢(只是猜测)。这时候主机断开重连一次可能就能抓到了。
![](https://img-blog.csdnimg.cn/20200120203937376.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI3NTc1ODQx,size_16,color_FFFFFF,t_70)
六、本文涉及的软件工具
链接:https://pan.baidu.com/s/1-P-jAOLgrkN6dihlCCVHEQ 提取码:8rgy