└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # How to spoof GPS signal 2 | 3 | 4 |

Hardware

5 |

SDR: HackRF One - 265€

6 | + HackRF One 7 | + Ant500 8 | 9 | 10 |

Clock: LeoBodnar Precision Frequency Reference GPS Clock - 197€

11 | + GPS Clock 12 | 13 |

Cables

14 | + Reduction SMA(M) - BNC(F) 50R 15 | + Coaxial cable BNC(M) - BNC(M) 1m 50R 16 | + USB A-B 17 | 18 |

Software

19 | https://mborgerson.com/getting-started-with-the-hackrf-one-on-ubuntu-14-04 20 | 21 |

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.

22 | 23 |

Don’t worry, this is going to be relatively painless.

24 | 25 |

Here’s what we’re going to do:

26 | 27 | 35 | 36 |

Install Dependencies

37 | 38 |
    39 |
  1. Install the build dependencies.

    40 | 41 |
    $ sudo apt-get install git \
     42 |                        build-essential \
     43 |                        cmake \
     44 |                        libusb-1.0-0-dev \
     45 |                        liblog4cpp5-dev \
     46 |                        libboost-dev \
     47 |                        libboost-system-dev \
     48 |                        libboost-thread-dev \
     49 |                        libboost-program-options-dev \
     50 |                        swig
     51 | 
  2. 52 | 53 |
  3. Create a working directory.

    54 | 55 |
    $ mkdir ~/sdr
     56 | 
  4. 57 |
58 | 59 |

Build HackRF Host Software

60 | 61 |
    62 |
  1. Clone the HackRF repository.

    63 | 64 |
    $ cd ~/sdr
     65 | $ git clone https://github.com/mossmann/hackrf.git
     66 | 
  2. 67 |
68 | 69 |

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.

70 | 71 |
    72 |
  1. Move to the hackrf/host directory.

    73 | 74 |
    $ cd hackrf/host
     75 | 
  2. 76 | 77 |
  3. Create the build directory, move to it, and use Cmake (installed earlier) to create the Makefiles required for building.

    78 | 79 |
    $ mkdir build && cd build
     80 | $ cmake ../ -DINSTALL_UDEV_RULES=ON
     81 | 
  4. 82 | 83 |
  5. Build and Install.

    84 | 85 |
    $ make
     86 | $ sudo make install
     87 | $ sudo ldconfig
     88 | 
  6. 89 |
90 | 91 |

Test the HackRF Device

92 | 93 |
    94 |
  1. Connect the your HackRF One.

  2. 95 | 96 |
  3. Run the hackrf_info tool to get some device information.

    97 | 98 |
    $ hackrf_info
     99 | Found HackRF board.
    100 | Board ID Number: 2 (HackRF One)
    101 | Firmware Version: ...
    102 | Part ID Number: ...
    103 | Serial Number: ...
    104 | 
  4. 105 |
106 | 107 |

Download and Install GNU Radio

108 | 109 |

Now let’s download and install GNU Radio.

110 | 111 |
$ sudo apt-get install gnuradio \
112 |                        gnuradio-dev \
113 |                        gr-iqbal
114 | 
115 | 116 |

Note: When I installed, I got version 3.7.2.1.

117 | 118 |

Download, Build, and Install GrOsmoSDR

119 | 120 |

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.

121 | 122 |
    123 |
  1. Clone the GrOsmoSDR repository:

    124 | 125 |
    $ cd ~/sdr
    126 | $ git clone git://git.osmocom.org/gr-osmosdr
    127 | 
  2. 128 |
129 | 130 |

Note: When I cloned, I got changeset 58d95b51.

131 | 132 |
    133 |
  1. Move to the repository:

    134 | 135 |
    $ cd gr-osmosdr
    136 | 
  2. 137 | 138 |
  3. Create the build directory, move to it, and use Cmake to create the Makefiles required for building.

    139 | 140 |
    $ mkdir build && cd build
    141 | $ cmake ../
    142 | 
  4. 143 | 144 |
  5. Build and Install.

    145 | 146 |
    $ make
    147 | $ sudo make install
    148 | $ sudo ldconfig
    149 | 
  6. 150 |
151 | 152 |

Download, Build, and Install Gqrx

153 | 154 |
    155 |
  1. Follow this instructions:

    156 |
    $ sudo apt-get install gqrx-sdr
    157 | $ sudo apt-get install libvolk1-bin
    158 | $ volk_profile
    159 | 
    160 | 161 |
  2. 162 |
163 | 164 | 165 |

Download, Build, and Install GPS-SDR-SIM

166 | 167 |
    168 |
  1. Clone the GPS-SDR-SIM repository:

    169 | 170 |
    $ cd ~/sdr
    171 | $ git clone https://github.com/osqzss/gps-sdr-sim
    172 | 
  2. 173 |
174 | 175 |
    176 |
  1. Move to the repository:

    177 | 178 |
    $ cd gps-sdr-sim
    179 | 
  2. 180 | 181 |
  3. To build it use GCC:

    182 |
    $ gcc gpssim.c -lm -fopenmp -o gps-sdr-sim
    183 | 
  4. 184 |
185 | 186 |

How to add path to home directory

187 | 188 | + open file browser home dir 189 | + Ctrl-H to show hidden files 190 | + open file: .bashrc 191 | + add this line: 192 | 193 |
export PATH="/home/user/sdr/gps-sdr-sim:$PATH"
194 | 
195 | 196 |

How to test external clock

197 |
$ hackrf_si5351c -n 0 -r
198 | 
199 | + [ 0] -> 0x01 clock is working 200 | + [ 0] -> 0x51 no clock 201 | 202 |

How to create NMEA path

203 | + create path in Google Earth 204 | + export the path as .KLM file 205 | + Import .KLM file and export NMEA text file using SatGen 206 | + example file name: nmea.txt 207 | 208 |

How to get BRDC file

209 | + Download latest daily GPS broadcast ephemers file (brdc) from ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2016/brdc/ 211 | + Example file name: brdc2400.16g 212 | 213 | 214 | 215 |

Prepare broadcast file

216 | + put both files into gps-sdr-sim folder 217 | + create gpssim.bin file by running: 218 | 219 | Dynamic mode: 220 |
$ gps-sdr-sim -b 8 -e brdc2400.16n -g nmea.txt
221 | 
222 | 223 | Static mode (location China): 224 |
$ gps-sdr-sim -b 8 -e brdc2400.16n -l 30.286502,120.032669,100
225 | 
226 | 227 | 228 |

Initiate broadcast

229 |
$ hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
230 | 
231 | 232 | 233 | 234 | --------------------------------------------------------------------------------