How to start with HackRF and gqrx
This is the first introduction to HackRF and gqrx.
The issues of analysis of radio broadcasting, beyond Wi-Fi, Bluetooth and BLE, are quite new to me. Therefore, when I received my HackRF in the mail, I had a question – what should I do with it? This article focuses on exactly this – how to test and receive radio signal with HackRF for the first time. For clarity, we will just listen to the FM radio. Something more serious will be in the following tutorials.
If you are also a beginner, then HackRF is a radio (Software-defined radio), a device that can send and receive radio waves in a very wide range. And gqrx is one of the programs for working with data received through HackRF (or other similar devices). This program has a graphical interface and is very suitable for the very first acquaintance with SDR.
Remember that HackRF should not be turned on, and especially being used to transmit or receive data if no antenna is connected to it!
How to Install Driver, HackRF Tools and SDR Utilities
This section contains software installation tips for specific Linux operating systems and distributions.
Most users are strongly advised, if you do not pursue the goal of developing or testing new features for HackRF, use the packages built for your system and install them using the package manager available for your operating system.
Kali Linux, Ubuntu, Debian, Linux Mint
sudo apt install hackrf gqrx-sdr
Fedora / Red Hat
sudo dnf install gnuradio gr-osmosdr hackrf gqrx -y
emerge hackrf-tools USE="hackrf" emerge gr-osmosdr
Arch linux, BlackArch
sudo pacman -S hackrf gnuradio gnuradio-osmosdr gnuradio-companion
OS X (10.5+)
sudo port install gr-osmosdr
brew install gr-osmosdr
Executables are provided as part of the PothosSDR project, which can be downloaded here: https://downloads.myriadrf.org/builds/PothosSDR/
You can use the binary package:
pkg install hackrf
You can build and install with ports:
cd /usr/ports/comms/hackrf make install
Assembly from source
Linux / OS X / *BSD
- Preparing your system
First, make sure that your system is updated using the update method provided on your operating system.
- Installation using PyBOMBS
The GNU Radio project has an assembly system that covers key libraries, drivers for SDR hardware, and many of the tree modules. PyBOMBs take care for you in installing dependencies.
- Building HackRF tools from source
Get the source code for the HackRF tools from either the release archive or git:
git clone https://github.com/mossmann/hackrf
After downloading the source code, the host tools can be compiled as follows:
cd hackrf/host mkdir build cd build cmake .. make sudo make install sudo ldconfig
If you have HackRF, then you may need to update the firmware to match the version of the host tools.
Where to buy HackRF
I bought from this seller. The peculiarity of buying a HackRF is that there are many configuration options:
You can buy a board, even without a USB power cable, or you can buy it with a case (Alloy Shell) and several antennas. The types of shells also vary. You also need to be careful, and not confuse the case without a board with the board itself – some cases (with a screen and a built-in battery) can cost as much as the board itself.
- 1 x HackRF One Software Defined Radio with Aluminum Alloy Shell
- 4 x HackRF SMA Antennas (40MHz-6GHz antenna;2.4G/5/5.8G antenna;70MHz-2700MHz antenna;40MHz-860MHz antenna)
- 1 x HackRF One special Shield cover(welded on the board)
- 1 x HackRF TCXO PPM0.1 GPS Clock module
- 1 x LG Micro USB cable
I liked that because there are several antennas for different needs.
The box came to me very crumpled form and while I was coming from the post office I was quite worried for the board:
Fortunately, the board was already in the case, and the case is quite strong and there was not a scratch on it.
The antennas look very fragile, but they turned out to be in perfect order – not bent or broken. Only the HackRF TCXO PPM0.1 GPS Clock module was unlucky, when the box was deformed, the legs pierced the package:
The legs themselves were also bent.
I straightened the legs with a flat screwdriver and installed this module on the HackRF board. I forgot to take a photo (and I’m too lazy to take it apart), and besides, I'm not sure I installed it correctly. Therefore, about the HackRF TCXO PPM0.1 GPS Clock module, why it is needed and how to use it will be in some subsequent article.
How to check HackRF
When HackRF is connected to a Linux computer, practically nothing happens – only the indicators on the board light up. The system itself does not have any built-in applets for connecting to HackRF.
Let's see the information:
Firstly, the device is detected, and the firmware 2018.01.1 is installed on it. The latest firmware version can be checked here: https://github.com/mossmann/hackrf/releases/. There is the same version, that is, an update is not required (how to update HackRF is written here).
Let's try to get data at maximum speed:
hackrf_transfer -r /dev/null -s 21500000
Let's try to send the data:
hackrf_transfer -t /dev/zero
At least the basic tests passed – despite the crumpled box, the device was not damaged.
How to receive a signal with HackRF
Install the gqrx program; for this, in Kali Linux, Debian, Linux Mint, Ubuntu and their derivatives, run the command:
sudo apt install hackrf gqrx-sdr
On BlackArch and Arch Linux, run the command:
sudo pacman -S gqrx
When you first start the setup window will appear, in it you can select the source of the received data and the sound output device. As a Device, I selected HackRF, and also increased the Input rate to a maximum value of 20000000.
Gqrx main window:
To start receiving a signal, click the “Start DSP processing” button, and to change the frequency, you can specify it in the “Frequency” window, or set it on the panel with numbers. The panel can be moved, for this grab the bottom row of numbers:
To stop receiving a signal, press the “Stop DSP processing” button (formerly the “Start DSP processing” button). If you want to unplug HackRF (for example, to change the antenna), then it is better to exit gqrx, because I had this program freeze after reconnecting HackRF.
While receiving the signal, the CPU load is rather high, probably due to the fact that I chose a high Input rate:
How to listen to FM radio with HackRF
The FM bands are 92.1-107.1 MHz. Since the frequency in the “Frequency” window is indicated in kHz (kilohertz), then we need to go to about 100000 kHz:
You can see that in this range there are many peaks – this is the broadcasts of radio stations.
For “Mode”, select “WFM (stereo)”.
Increase the “Gain” value, otherwise it will be too quiet.
By clicking on the “Bookmark” button, you can save frequencies to bookmarks.
If you click on the “Rec” button, then you can record audio.
A short video where I learn the gqrx interface:
This is just the beginning! Next, we will deal with signal sources and methods for decoding them. With HackRF, you can detect a variety of devices: from wireless doorbells to bugs, hidden cameras and radars. Some types of signals can be decrypted: walkie-talkies, outdated telephone standards, etc. Some types of signals can only be traced: Wi-Fi, modern telephone standards, etc. In any case, the world of radio waves is very vast and interesting!
Last Updated on
- New Kismet version (81.3%)
- How to increase TX-Power of Wi-Fi adapters in BlackArch in 2018 (50%)
- How to install the latest aircrack-ng release in Linux Mint or Ubuntu (50%)
- How to install airgeddon on Linux Mint or Ubuntu (31.3%)
- Fix for Reaver Errors: WARNING: Failed to associate with and WPS transaction failed (code: 0x03), re-trying last pin (31.3%)
- Programs for hacking Wi-Fi (RANDOM - 31.3%)