0

Adafruit BLE Sniffer installation on Windows Step-by-Step
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit BLE Sniffer installation on Windows Step-by-Step

by TomHildebrand on Fri Sep 17, 2021 7:44 pm

After receiving my BLE sniffer from Adafruit yesterday, it took me a lot longer than expected to get it to work with my Windows 10 laptop. The information is there, on the Adafruit website and other sources, but it was confusing to me, especially with the different versions of software to use (python2, not python3, Beta version, not latest version etc). So I wrote down every successful/necessary step (and omitting the countless dead ends) in the .pdf document in the link below. I then repeated every step from the document on another laptop to confirm that it works. It does. I am now happily sniffing BLE packets. The document is also repeated below, but it may be easier to read as a .pdf


Adafruit BLE Sniffer Installation on Windows 10
Tom Hildebrand
9/17/2021


The installation requires the following components and steps:

(1) Hardware
Adafruit BLE Sniffer hardware. The product has an on-board Silicon Labs CP210x USB-to-UART bridge, and is preloaded with Silicon Labs sniffer firmware version 2. With the proper driver (see below), it looks to Windows like a COM port. Install the driver (step 2 below), then plug the sniffer dongle into a USB port. The product description is here: https://www.adafruit.com/product/2269


(2) USB/UART bridge driver
Silicon Labs CP210x USB to UART bridge VCP driver
https://www.silabs.com/documents/public ... Driver.zip Other operating systems drivers are also available at their website https://www.silabs.com
Install the USB/UART bridge driver (see above) by extracting the downloaded zip file and running the 64-bit installer CP210xVCPinstaller_x64.exe (or the 32-bit x86 version if your Windows is still 32bit). After the installation, insert the sniffer dongle into a USB port on your computer (direct USB, avoid USB hubs). The sniffer should now be visible in Computer Management > Device Manager > Ports (COM and LPT). It will be listed as “ Silicon Labs CP210x UART Bridge (COMxyz)”.


(3) Python 2
The extcap code below (plugin for Wireshark) was written in/for Python2. Although this is an old version of Python (everybody uses Python3 these days) you need Python2 for this project. The extcap code will not run under Python3. Download the latest (terminal) release of Python2 https://www.python.org/ftp/python-2718/ ... .amd64.msi
Run the downloaded .msi installer. When asked, choose an installation target directory, e.g.
Code: Select all | TOGGLE FULL SIZE
     C:\Program Files\Python27

Now add Python to the command search paths: Search bar > Search “env”. Select the suggested “Edit System Environment Variables” > Tab “Advanced” > Environment variables. In the System Variables list (bottom) highlight “Path” > Edit. Press “NEW” to add a new path. Enter
Code: Select all | TOGGLE FULL SIZE
     C:\Program Files\Python2

(or wherever you installed Python2 in the previous step) and press OK. Then add a path to
Code: Select all | TOGGLE FULL SIZE
     C:\Program Files\Python27\Scripts

and press “OK” , then “OK” on the parent windows that led here. To test the new paths, close all open command prompt windows (if any), open a new command prompt window and type
Code: Select all | TOGGLE FULL SIZE
     path

The new Python27 paths should be in there. In the command prompt window, type
Code: Select all | TOGGLE FULL SIZE
     python

and you should get the interactive Python shell. We don’t need it now, so close it by typing
Code: Select all | TOGGLE FULL SIZE
     <CTRL-Z> <Return>




(4) Python installer “PIP”
We will soon need to install the pyserial package for Python. You can either install pyserial manually (cumbersome) or install a package installer “pip” first (easy), and then pyserial (now also easy). So let’s do that. Open a command window with administrator privileges: in the Windows search box type “command”. In the best match search result, right-click on “Command Prompt” and select “Run as administrator”. In the window that opens, type
Code: Select all | TOGGLE FULL SIZE
     python -m ensurepip –upgrade

That will install “pip”, the Python Package Installer. Try it by typing
Code: Select all | TOGGLE FULL SIZE
     pip

in the same command window, it should just show a help page.

(5) pyserial (Python Serial library)
While still in the administrator command window from the previous step, type
Code: Select all | TOGGLE FULL SIZE
     pip install pyserial

That’s all. You will get a warning that Python2 is old and you should consider Python3. Ok we know that. You may also get a warning that the version of pip we just installed is already outdated. Optionally follow the suggested command to update pip to the latest (but it’s not required for this project).



(6) extcap (plugin for Wireshark)
Install the Nordic Semiconductor extcap (version2.0.0 Beta 1) plugin for Wireshark. Use only this version, do not use version 4 or any other version, they will not work. Download it from the Adafruit website https://cdn-learn.adafruit.com/assets/a ... extcap.zip Extract the contents of the .zip file into the Wireshark extcap folder
Code: Select all | TOGGLE FULL SIZE
     C:\Program Files\Wireshark\extcap

(unless you used a different install path). To test the installation, open a command window and go to the Wireshark extcap folder.
Code: Select all | TOGGLE FULL SIZE
     cd C:\Program Files\Wireshark\extcap

You should see -among other perhaps- a file nrf_sniffer.py and nrf_sniffer.bat. The .bat file is just a helper file to invoke the .py script which for some reason Windows cannot run directly. The code is to be invoked by Wireshark with certain parameters (arguments), but let’s first see if it can be compiled / interpreted without compile errors by typing in the command shell (while in the extcap directory):
Code: Select all | TOGGLE FULL SIZE
     nrf_sniffer.bat

You should get no compiler errors, but you should get the message “No arguments given!”, which is the outcome we were hoping for. We did, after all, invoke nrf_sniffer without any parameters (arguments).


(7) Wireshark
Download and run the latest Windows Installer (64bit) for Wireshark from https://www.wireshark.org/download.html During the installation, accept all suggested components. Accept (or modify) the suggested install path. Accept the suggestion to install Npcap (it is needed). When offered, select installation of USBpcap too. Now Reboot Windows.


(8) Using Wireshark with the BLE sniffer
Start Wireshark. The sniffer should now appear as one of the data sources:
Code: Select all | TOGGLE FULL SIZE
     rNF Sniffer (COMxyz)

Double click on it to start capturing Bluetooth Low Energy (BLE) data packets.
Attachments
Adafruit BLE Sniffer Installation for Windows 10.pdf
(490.05 KiB) Downloaded 3 times

TomHildebrand
 
Posts: 3
Joined: Tue Sep 14, 2021 1:23 am

Re: Adafruit BLE Sniffer installation on Windows Step-by-Ste

by mboere on Mon Sep 20, 2021 9:45 am

Hi,

The Windows 10 installation manual is great stuff!

I installed Wireshark 3.4.8 (64bit), python-2.7 (64bit) and pyserial-3.5. I also change the extcap folder within Wireshark.

So far so good.

But I just couldn’t get the sniffer working on Windows 10 (64 bit), each time I got a message that Python wasn’t found? I really tried everything but that didn’t help.

So finally I changed the nrf_sniffer.bat file within the extcap folder. As always the solution was very simple, I just added one small line within nrf_sniffer.bat (Please refer to the attachment).

Could be that people don’t face problems, but in my case It worked for the sniffer.

Kind regards

Martin
Attachments
nrf_sniffer.jpg
nrf_sniffer.jpg (29.15 KiB) Viewed 95 times

mboere
 
Posts: 6
Joined: Wed Sep 15, 2021 4:45 am

Re: Adafruit BLE Sniffer installation on Windows Step-by-Ste

by TomHildebrand on Mon Sep 20, 2021 11:30 am

MBOERE,
glad it worked for you in the end. It appears that your system didn't find the python compiler/interpreter because there was no "path" to it. Apparently you chose to install python in the C:\Python directory, which is perfectly ok (it is actually the default suggested by the installer, I think). See the first code snippet in section "(2) Python 2" of the instructions above. But wherever you choose to install it, the paths in the second and third code snippet have to match.

So if you install Python2 into C:\Program Files\Python27 then the paths must be
Code: Select all | TOGGLE FULL SIZE
C:\Program Files\Python2 and C:\Program Files\Python27\Scripts

Likewise, if yo install Python2 into C:\Python27 then the paths must be
Code: Select all | TOGGLE FULL SIZE
C:\Python2 and C:\Python27\Scripts


You circumvented the problem by changing the script to explicitly use the directory where you installed Python2 as the current directory: CD C:\Python2 That works.
BTW I'm not sure if the second path statement above "C:\Program Files\Python27\Scripts" is strictly needed but it doesn't hurt.
Happy sniffing.

TomHildebrand
 
Posts: 3
Joined: Tue Sep 14, 2021 1:23 am

Re: Adafruit BLE Sniffer installation on Windows Step-by-Ste

by Cyril1 on Wed Oct 06, 2021 11:18 am

What is the best Windows to use for this?

Cyril1
 
Posts: 1
Joined: Wed Oct 06, 2021 6:28 am

Re: Adafruit BLE Sniffer installation on Windows Step-by-Ste

by TomHildebrand on Wed Oct 06, 2021 12:04 pm

Re: What is the best Windows to use for this?
I used my regular laptop with Windows 10 (64-bit with latest updates). In my opinion this is the best version because a) it is the most up-to date version and b) it works well for the intended use in this thread.

TomHildebrand
 
Posts: 3
Joined: Tue Sep 14, 2021 1:23 am

Please be positive and constructive with your questions and comments.