How to spoof GPS signal
Hardware
+ SDR: HackRF One - 265€HackRF One + Ant500
+ Clock: LeoBodnar Precision Frequency Reference GPS Clock - 197€GPS Clock
+ Reduction SMA(M) - BNC(F) 50R + Coaxial cable BNC(M) - BNC(M) 1m 50R + USB A-B Cables
Softwarehttps://mborgerson.com/getting-started-with-the-hackrf-one-on-ubuntu-14-04
Figuring out what you need to install to get going can be a drag, so I’ll spare you the work and tell you how to quickly get started on an Ubuntu 14.04 LTS system.
Don’t worry, this is going to be relatively painless.
Here’s what we’re going to do:
- Install some dependencies,
- Build and Install the HackRF Host Software (libraries and tools),
- Install GNU Radio,
- Build and Install GrOsmoSDR,
- Build and Install Gqrx, and finally
- Use Gqrx to tune into a local FM radio station.
Install Dependencies
Install the build dependencies.
$ sudo apt-get install git \ build-essential \ cmake \ libusb-1.0-0-dev \ liblog4cpp5-dev \ libboost-dev \ libboost-system-dev \ libboost-thread-dev \ libboost-program-options-dev \ swig
Create a working directory.
$ mkdir ~/sdr
Build HackRF Host Software
Clone the HackRF repository.
$ cd ~/sdr $ git clone https://github.com/mossmann/hackrf.git
Note: When I cloned, I got changeset 740940f8
. As this article ages, you will likely get a different version, and that’s okay. I’m just recording this as a known-working version.
Move to the hackrf/host directory.
$ cd hackrf/host
Create the build directory, move to it, and use Cmake (installed earlier) to create the Makefiles required for building.
$ mkdir build && cd build $ cmake ../ -DINSTALL_UDEV_RULES=ON
Build and Install.
$ make $ sudo make install $ sudo ldconfig
Test the HackRF Device
Connect the your HackRF One.
Run the
hackrf_info
tool to get some device information.$ hackrf_info Found HackRF board. Board ID Number: 2 (HackRF One) Firmware Version: ... Part ID Number: ... Serial Number: ...
Download and Install GNU Radio
Now let’s download and install GNU Radio.
$ sudo apt-get install gnuradio \
gnuradio-dev \
gr-iqbal
Note: When I installed, I got version 3.7.2.1.
Download, Build, and Install GrOsmoSDR
Now we’ll download, build, and install GrOsmoSDR. GrOsmoSDR is essentially middle-ware that allows GNU Radio to communicate with the HackRF software to control your HackRF One.
Clone the GrOsmoSDR repository:
$ cd ~/sdr $ git clone git://git.osmocom.org/gr-osmosdr
Note: When I cloned, I got changeset 58d95b51
.
Move to the repository:
$ cd gr-osmosdr
Create the build directory, move to it, and use Cmake to create the Makefiles required for building.
$ mkdir build && cd build $ cmake ../
Build and Install.
$ make $ sudo make install $ sudo ldconfig
Download, Build, and Install Gqrx
Follow this instructions:
$ sudo apt-get install gqrx-sdr $ sudo apt-get install libvolk1-bin $ volk_profile
Download, Build, and Install GPS-SDR-SIM
Clone the GPS-SDR-SIM repository:
$ cd ~/sdr $ git clone https://github.com/osqzss/gps-sdr-sim
Move to the repository:
$ cd gps-sdr-sim
To build it use GCC:
$ gcc gpssim.c -lm -fopenmp -o gps-sdr-sim
How to add path to home directory
- open file browser home dir
- Ctrl-H to show hidden files
- open file: .bashrc
- add this line:
export PATH="/home/user/sdr/gps-sdr-sim:$PATH"
How to test external clock
$ hackrf_si5351c -n 0 -r
+ create path in How to create NMEA pathGoogle Earth + export the path as .KLM file + Import .KLM file and export NMEA text file using SatGen + example file name: nmea.txt
+ Download latest daily GPS broadcast ephemers file (brdc) from ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2016/brdc/ + Example file name: brdc2400.16g How to get BRDC file
+ put both files into gps-sdr-sim folder + create gpssim.bin file by running: Prepare broadcast file
Dynamic mode:
$ gps-sdr-sim -b 8 -e brdc2400.16n -g nmea.txt
Static mode (location China):
$ gps-sdr-sim -b 8 -e brdc2400.16n -l 30.286502,120.032669,100
Initiate broadcast
$ hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0