How to install the rtl-sdr and listen to cellphone towers with the Pine64 (or Orange Pi)
Story
I bought two Pine a64 2Gb boards when there was a liquidation at my local electronics store half a year ago. Since then they were lying around and collecting dust, mainly because they are a lot more difficult to use than the raspberry pi. I finally found a good use for one. I installed a 12 $ rtlsdr dongle (RTL2832U), so I can listen to the frequencies in the air from 500 kHz up to 1.75 GHz. This means the device receives data from radio, planes, satellites, garage doors and also some mobile communication. One of the most interesting things was to see how smartphones communicate with towers. The following instructions seem pretty long but it is easier than you think and most is copy and paste code.
Installation of Armbian and the RTL-SDR dongle
1. Download the latest Armbian OS (based on Ubuntu) for your device. You should pick the one with graphical desktop. Then on a Windows PC you can unpack it using the free tool 7zip and install the .img file on a microSD card with Win32DiskImager.
2. Hook up the pine64 on a screen with an hdmi cable. Add a usb mouse and keyboard.
Now plug in the microSD and and power the device up. The first boot will take a bit longer then usual.
Eventually, you will be asked to sign in with a username and password. This is for armbian “root” and “1234”.
Now you are prompted to create a new password for the root account and you need to create a normal user with username and password. If you want to access the command line of the pine64 from a windows pc you can use SSH with Putty. Great, now all the basic stuff is done.
3. When you plug in the rtlsdr dongle you should be able to see it in the list created with:
lsusb
.
For me it looks like this:
Bus 001 Device 003: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
In my case “0bda” is the vendor identification and “2838” is the product number.
Run
sudo nano /etc/udev/rules.d/20.rtlsdr.rules
to write a new file with the content:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"
You need to insert the vendor id and product number of your device if it is different than my example. This should ensure that the rtl-sdr is available for the pine.
Installation of GNU Radio
1. In the terminal, update the system with:
sudo apt-get update && sudo apt-get upgrade
.
2. First, you can run
sudo apt install gnuradio
to install GNU Radio, which is a software that lets you process information from software radios. Next, you install the rtl-sdr tools. Note that some of the steps can take very long to compute on the Pine a64.
git clone https://github.com/balint256/gr-baz.git cd gr-baz mkdir build cd build sudo apt-get install cmake sudo apt-get install gnuradio-dev cmake .. make sudo make install sudo ldconfig
Installation of Gr-Gsm
1. The installation of gr-gsm follows the instructions from osmocom. First, you need to install a few modules, that are required for the software:
sudo apt-get update && \ sudo apt-get install -y \ cmake \ autoconf \ libtool \ pkg-config \ build-essential \ python-docutils \ libcppunit-dev \ swig \ doxygen \ liblog4cpp5-dev \ python-scipy \ python-gtk2 \ gnuradio-dev \ gr-osmosdr \ libosmocore-dev
2. When this is done, you can install gr-gsm, which is required to see gsm communication:
cd ~ git clone https://git.osmocom.org/gr-gsm cd gr-gsm mkdir build cd build cmake .. mkdir $HOME/.grc_gnuradio/ $HOME/.gnuradio/ cd ~/gr-gsm/build make sudo make install sudo ldconfig
Next, you need some Python modules to run the IMSI-catcher script:
sudo apt-get install python-numpy python-scipy python-scapy
Then, you can download the scripts:
git clone https://github.com/Oros42/IMSI-catcher
Run the following line to update the mobile provider list:
sudo apt-get install python-bs4 python IMSI-catcher/mcc-mnc/update_codes.py
3. Let the fun part begin. You need to have a graphical desktop in front of you. Open two terminal windows. In the first one you enter
grgsm_scanner
to see on what frequencies there are towers around you. Then, start to listen to one of those frequencies with:
grgsm_livemon -f 'YOURFREQUENCY'M
.
e.g.
grgsm_livemon -f 948.2M
In the second window you start to receive the processed data in the form of a list with IMSI numbers, phone providers and countries. To get this run inside the IMSI-catcher folder:
python simple_IMSI-catcher.py
There you go. I hope you have as much fun as I had with this tool 🙂 More information can be found here.
Hint: If you want the data to be directly stored in a textfile, use:
python simple_IMSI-catcher.py >> yourfile.txt