Friday, August 5, 2016

Sniffing GSM packets

These are the steps I followed to capture GSM packets using a HackRF SDR device and view it on Wireshark protocol analyzer.

(1) Download the following Ubuntu live iso image which contains GNURadio pre-configured. Then, prepare a live USB stick using this image. I used Ubuntu startup disk creator for this purpose. This is where we start.

s3-dist.gnuradio.org/ubuntu-14.04.3-desktop-amd64-gnuradio-3.7.9.iso

(2) When your live USB stick is ready, boot the laptop with it. Then let's install some packags as follows.

sudo apt-get install git cmake libboost-all-dev libcppunit-dev swig doxygen liblog4cpp5-dev python-scipy

 
(3) Now we should download the source code, build locally and install one important module called gr-gsm which has all the necessary tools to capture the GSM packets using HackRF and then directing it to Wireshark with a proper format.

cd Downloads
git clone https://github.com/ptrkrysik/gr-gsm.git
cd gr-gsm
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig



(4) Open the file ~/.gnuradio/config.conf and append following two lines to the end of it. In order to edit and save the file, I didn't need root permission.

[grc]
local_blocks_path=/usr/local/share/gnuradio/grc/blocks


(5)  Now, let's install another important package.

cd Downloads
git clone https://github.com/scateu/kalibrate-hackrf.git
cd kalibrate-hackrf
./bootstrap
./configure
make
sudo make install


(6) Now let's run calibrate tool and scan the frequency range for GSM networks.

cd Downloads/kalibrate-hackrf/src
./kal -s GSM900 -g 40 -l 40


Now we have to wait a while until this tool discovers and lists down all the frequency channels used by GSM networks in the area. We will refer to the data we found here later.

(7) Install Wireshark if you haven't done yet.

sudo apt-get install wireshark


(8) Go to the place where we downloaded gr-gsm. Then open the given GRC script using Gnuradio Companion tool. Update the gain value to 40. Now run the GRC script. We will get a new window where we can select the GSM channel frequency we need to sniff.

cd Downloads/gr-gsm/apps
sudo gnuradio-companion gr-gsmlivemon.grc


(9) While the above tool is running, open a new terminal and enter the following command to run Wireshark with the appropriate filters.

sudo wireshark -k -Y 'gsmtap && !icmp' -i lo

Now we should see a subset of GSM packets from GSM networks are appearing in Wireshark window.

References:

[1] http://dilsdomain.blogspot.sg/2016/01/install-requirements-for-gsm-band.html
[2]
http://dilsdomain.blogspot.com/2016/01/sniffing-gsm-traffic-with-hackrf.html
[3] https://z4ziggy.wordpress.com/2015/05/17/sniffing-gsm-traffic-with-hackrf/

No comments:

Post a Comment