A comprehensive tutorial for setting up and using HackRF One on Windows. This repository provides detailed step-by-step instructions, code samples, and troubleshooting tips—filling the gap left by Linux-focused guides. It also integrates modified code from jamRF_v1.py
Caution
This repository is provided for educational purposes only. Unauthorized transmission of signals on any frequency band is strictly prohibited. The code is distributed "as is," without any warranties, including but not limited to warranties of merchantability, fitness for a particular purpose, or noninfringement. The authors and contributors shall not be held liable for any damages or legal issues arising from the use or misuse of this code. Use it at your own risk, and ensure compliance with all applicable laws and regulations. By using or distributing this software, you acknowledge that you have read and understood this disclaimer.
HackRF One is a popular, low-cost, open-source software-defined radio (SDR) platform. While many setup guides assume a Linux environment, this project is tailored for Windows users. Whether you prefer using Conda, WSL, or Docker, this guide covers various methods to get you started.
- Step-by-step setup guide for HackRF One on Windows
- Windows-specific code samples and scripts
- Integration of selected functions from jamRF_v1.py
- Troubleshooting tips and FAQ
- Operating System: Windows 10 or later
- Device: HackRF One, Micro USB cable (for connecting HackRF to your PC)
- Python: Version 3.6 or higher
Note
There are two popular firmware:
- (Preferred) Stock HackRF One firmware uses a date-based tag in the YYYY.MM.DD format (e.g., 2024.02.1).
To update or verify your firmware, see the official instructions at Updating Firmware - (Most common preloaded) Mayhem (PortaPack) firmware uses semantic versioning in the vX.X.X format (e.g., v2.1.0).
For details on Mayhem updates, see the PortaPack Mayhem repository
Sometimes Mayhem (PortaPack) firmware might require using Zadig (as shown in the screenshots under the 2nd step in the conda setup section) to resolve “No HackRF boards found.” errors.
-
Prepare Essentials:
-
Connect and Verify HackRF One
- Plug in your HackRF One with a micro USB cable.
- Open the Device Manager to check if your PC recognizes the device.
- If not recognized properly, download and run Zadig:
-
Clone the Repository Open a Command Prompt and run:
git clone https://github.com/whiteSHADOW1234/HackRF-One-for-Windows.git
This will download the files
jamRF_v1.py
andconfig_v1.yaml
. -
Set Up the Python Environment
-
Launch Visual Studio Code (or your preferred editor) and open the cloned repository.
-
If you see unresolved package errors (e.g., as shown below), proceed with the following steps:
-
Open a Command Prompt (by) and run:
conda create -n hackrf_env -c conda-forge gnuradio gnuradio-osmosdr hackrf -y conda activate hackrf_env
-
Then, in VSCode, change the Python interpreter to
hackrf_env
: -
And restart the terminal, the error message (
import XXX could not be found
) should now be resolved.
-
- Verify and Run
-
In the terminal, run the following command to ensure HackRF One details are displayed.
> hackrf_info hackrf_info version: 2024.02.1 libhackrf version: 2024.02.1 (0.9) Found HackRF Index: 0 Serial number: 0000000000000000a18c63dc2b3c6813 Board ID Number: 2 (HackRF One) Firmware Version: v2.0.1 (API:1.08) Part ID Number: 0xa000cb3c 0x00614766 Hardware Revision: older than r6 Hardware supported by installed firmware: HackRF One
-
Run
python jamRF_v1.py
in the terminal> python jamRF_v1.py 1 100 JAM! The frequency currently jammed is: 2412.0MHz gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.12.0 built-in sink types: uhd hackrf bladerf soapy redpitaya file Using HackRF One with firmware v2.0.1 Detected Windows OS 100 pagesize :debug: Setting pagesize to 4096 B top_block_impl :debug: Using default scheduler "TPB" UUUUUUUU
-
-
Install Prerequisites:
- Install Git and Miniconda (or Anaconda).
- Install Radioconda. No special installation steps are needed beyond the defaults.
-
Connect and Verify HackRF One
- Plug in your HackRF One with a micro USB cable.
- Open the Device Manager to check if your PC recognizes the device.
- If HackRF One is not recognized, run Zadig, select List All Devices, choose HackRF One, and click Downgrade WCID Driver.
-
Clone the Repository Open a Command Prompt and run:
git clone https://github.com/whiteSHADOW1234/HackRF-One-for-Windows.git
This will download the project files, including
jamRF_v1.py
andconfig_v1.yaml
. -
Verify and Run
-
In the Radioconda prompt, run the following to verify that your HackRF One is correctly recognized:
> hackrf_info hackrf_info version: 2024.02.1 libhackrf version: 2024.02.1 (0.9) Found HackRF Index: 0 Serial number: 0000000000000000a18c63dc2b3c6813 Board ID Number: 2 (HackRF One) Firmware Version: v2.0.1 (API:1.08) Part ID Number: 0xa000cb3c 0x00614766 Hardware Revision: older than r6 Hardware supported by installed firmware: HackRF One
-
Then, run the script:
> cd HackRF-One-for-Windows > python jamRF_v1.py 1 100 JAM! The frequency currently jammed is: 2412.0MHz gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.12.0 built-in sink types: uhd hackrf bladerf soapy redpitaya file Using HackRF One with firmware v2.0.1 Detected Windows OS 100 pagesize :debug: Setting pagesize to 4096 B top_block_impl :debug: Using default scheduler "TPB" UUUUUUUU
-
-
Install Prerequisites:
- Install Git and WSL with a Linux distrobution (take Ubuntu for example).
- Install usbipd-win (.msi) from its GitHub releases.
-
Connect and Verify HackRF One
- Plug in your HackRF One with a micro USB cable.
- Open the Device Manager to check if your PC recognizes the device.
- If not, run Zadig, select List All Devices, choose HackRF One, and click Downgrade WCID Driver.
-
Clone the Repository Open a Command Prompt and run:
git clone https://github.com/whiteSHADOW1234/HackRF-One-for-Windows.git
This will download the files
jamRF_v1.py
andconfig_v1.yaml
. -
Install Linux Dependencies in WSL:
- Open PowerShell and list your WSL distributions
wsl --list --verbose
- Launch your chosen Linux distribution:
wsl -d <YOUR_LINUX_DISTRIBUTION>
- Install the necessary packages
sudo apt update sudo apt install gnuradio gr-osmosdr hackrf -y
- Verify HackRF detection (It might not detect the device like the following output):
> lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- Open PowerShell and list your WSL distributions
-
Bind the HackRF USB Port to WSL:
- In a new PowerShell window, list connected USB devices:
> usbipd list Connected: BUSID VID:PID DEVICE STATE 2-1 1d50:6089 HackRF One Not shared 2-3 30c9:000e HP Wide Vision HD Camera Not shared 2-10 8087:0026 Intel(R) Wireless Bluetooth(R) Not shared Persisted: GUID DEVICE
- Bind and attach HackRF (replace with your HackRF’s bus ID):
> usbipd bind --busid 2-1 > usbipd list Connected: BUSID VID:PID DEVICE STATE 2-1 1d50:6089 HackRF One Shared 2-3 30c9:000e HP Wide Vision HD Camera Not shared 2-10 8087:0026 Intel(R) Wireless Bluetooth(R) Not shared Persisted: GUID DEVICE > usbipd attach --wsl --busid 2-1 > usbipd list Connected: BUSID VID:PID DEVICE STATE 2-1 1d50:6089 HackRF One Attached 2-3 30c9:000e HP Wide Vision HD Camera Not shared 2-10 8087:0026 Intel(R) Wireless Bluetooth(R) Not shared Persisted: GUID DEVICE
- Confirm the attachment by rechecking in the old window with:
> lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 1d50:6089 OpenMoko, Inc. Great Scott Gadgets HackRF One SDR Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- In a new PowerShell window, list connected USB devices:
-
Test and Run
- In WSL, run the following command to ensure HackRF is recognized.
$ hackrf_info hackrf_info version: unknown libhackrf version: unknown (0.6) Found HackRF Index: 0 Serial number: 0000000000000000a18c63dc2b3c6813 Board ID Number: 2 (HackRF One) Firmware Version: v2.0.1 (API:1.08) Part ID Number: 0xa000cb3c 0x00614766
- Navigate to the cloned repository and execute the script
$ python3 jamRF_v1.py 1 100 JAM! The frequency currently jammed is: 2412.0MHz gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.1.1 built-in sink types: uhd hackrf bladerf soapy redpitaya freesrp file [INFO] [UHD] linux; GNU C++ version 11.2.0; Boost_107400; UHD_4.1.0.5-3 libusb: warning [libusb_exit] device 2.1 still referenced libusb: warning [libusb_exit] device 1.2 still referenced libusb: warning [libusb_exit] device 1.1 still referenced Using HackRF One with firmware v2.0.1 Detected Linux OS 100 UUUUUUUUUU
- In WSL, run the following command to ensure HackRF is recognized.
-
Device Not Found
- Error:
Exception has occurred: RuntimeError Failed to use '0' as HackRF device index: not enough devices File "C:\Users\<USER_NAME>\Desktop\HackRF-One-for-Windows\jamRF_v1.py", line 130, in jam osmosdr_sink = osmosdr.sink("hackrf=0") ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\<USER_NAME>\Desktop\HackRF-One-for-Windows\jamRF_v1.py", line 271, in <module> jam(freq, waveform, power, t_jamming) RuntimeError: Failed to use '0' as HackRF device index: not enough devices
- Solution: Try switching to a different USB port or update the USB driver.
- Error:
-
Device Misidentification
- Observation
When running
usbipd list
, HackRF appears as aUSBIP Shared Device
(and similarly in Device Manager) instead ofHackRF One
. - Solution Update the USB driver, unplug and replug the HackRF, or use a different USB port.
- Observation
When running
-
DLL Errors
- Error
python jamRF_v1.py Traceback (most recent call last): File "C:\Users\<USER_NAME>\miniconda3\envs\hackrf_env\Lib\site-packages\gnuradio\blocks\__init__.py", line 18, in <module> from .blocks_python import * ImportError: DLL load failed while importing blocks_python: 找不到指定的模組。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\<USER_NAME>\Desktop\WiFi-Jamming\jamRF_v1.py", line 19, in <module> from gnuradio import blocks File "C:\Users\<USER_NAME>\miniconda3\envs\hackrf_env\Lib\site-packages\gnuradio\blocks\__init__.py", line 22, in <module> from .blocks_python import * ImportError: DLL load failed while importing blocks_python: 找不到指定的模組。
- Solution Remove any conflicting conda environments or WSL distrobutions to ensure only one is accessing the HackRF device.
- Error
-
Access Denied error, even when running as Administrator.
- Error
$ hackrf_info hackrf_info version: unknown libhackrf version: unknown (0.6) Found HackRF Index: 0 hackrf_open() failed: Access denied (insufficient permissions) (-1000)
- Solution Remove any conflicting conda environments or WSL distrobutions to ensure only one is accessing the HackRF device.
- Error
-
avahi_service_browser_new()
Failed- Error
python3 jamRF_v1.py 1 100 JAM! The frequency currently jammed is: 2412.0MHz gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.1.1 built-in sink types: uhd hackrf bladerf soapy redpitaya freesrp file [INFO] [UHD] linux; GNU C++ version 11.2.0; Boost_107400; UHD_4.1.0.5-3 [ERROR] avahi_service_browser_new() failed: Bad state libusb: warning [libusb_exit] device 2.1 still referenced libusb: warning [libusb_exit] device 1.2 still referenced libusb: warning [libusb_exit] device 1.1 still referenced Using HackRF One with firmware v2.0.1 100 vmcircbuf_prefs::get :error: /home/<USER_NAME>/.gnuradio/prefs/vmcircbuf_default_factory: No such file or directory gr::vmcircbuf :error: vmcircbuf_createfilemapping: createfilemapping is not available
- Solution
Install
avahi-daemon
by executingsudo apt install avahi-daemon -y
in the WSL distrobution will fix.
- Error