Using HackRF to Spoof GPS Signals
环境:Windows 10
win10都可以,linux不会有问题的吧
关于本文中的所有链接,文末有整合地址,如果你们不嫌弃慢可以去那里下载
伪造GPS信号原理
这个没啥好说的,就是用一个更强的信号覆盖掉微弱的GPS信号。
下载Hackrf_Tools
这个不好找,只能去Github下,然后编译。我提供的整合包里有这些文件。
下载gps-sdr-sim
建议下载Release,不用自己编译,而且windows直接用。
生成仿真信号的时候需要RINEX星历数据,Release版的gps-sdr-sim已经自带一个上古版本的星历了(2014年的),更新一下。
RINEX星历数据下载地址
地址中的2020可以换成你当前年份
拉到最下面,下载brdc2780.20n.Z,然后解压就是了。(注意要是以n结尾的星历)
生成GPS仿真数据
./gps-sdr-sim -e brdc2780.20n -l 0,0,100 -b 8·
指定星历文件,设置经纬度,必须指定采样精度为8。
默认情况下只生成300秒的仿真数据,因为生成的文件太大了,怕你硬盘塞不下去2333。
发射仿真数据
hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
-t 指定GPS数据
-f 指定频率为1575420000 即民用GPS L1波段频率。
-s 指定采样速率2.6Msps
-a 开启天线增益 1=Enable, 0=Disable
-x 指定TX VGA(IF)的增益,数据范围0-47dB (为了限制影响范围,最大为47慎用,小心查水表)
请尽量避免使用手机进行测试,使用其他GPS终端。
因为手机会采用多重方法进行定位,比如基站,Wifi,GPS。这类多重定位的东西不好干扰。
相关链接
Environment: Windows 10
If it works on Win10, it should be fine on Linux, right?
All links mentioned in this article are consolidated at the end. If you don’t mind slow download speeds, you can grab them there.
How GPS Spoofing Works
There’s not much to say here—it’s basically about overpowering weak GPS signals with a stronger one.
Download HackRF_Tools
It’s not easy to find pre-built binaries. You’ll probably need to download and compile it from GitHub. My resource pack includes these files.
Download gps-sdr-sim
I recommend downloading the Release version to avoid compiling it yourself. It works directly on Windows.
When generating simulated signals, you’ll need RINEX ephemeris data. The Release version of gps-sdr-sim already includes an ancient ephemeris file (from 2014), so it’s best to update it.
RINEX Ephemeris Data Download
Replace 2020 in the URL with the current year
Scroll to the bottom and download brdc2780.20n.Z, then extract it. (Make sure it’s an ephemeris file ending in ‘n’.)
Generate GPS Simulation Data
./gps-sdr-sim -e brdc2780.20n -l 0,0,100 -b 8
Specify the ephemeris file, set the latitude and longitude, and you must set the sample precision to 8.
By default, it generates only 300 seconds of simulation data because the file size would be too large (otherwise, you’d run out of disk space, lol).
Transmit Simulation Data
hackrf_transfer -t gpssim.bin -f 1575420000 -s 2600000 -a 1 -x 0
-t specifies the GPS data file
-f sets the frequency to 1575420000, which is the civil GPS L1 band frequency.
-s sets the sample rate to 2.6 Msps
-a enables antenna gain: 1=Enable, 0=Disable
-x sets the TX VGA (IF) gain, range 0–47 dB (To limit the range of effect, max is 47 dB. Use with caution to avoid trouble.)
Please avoid using a mobile phone for testing; use other GPS devices instead.
Phones use multiple methods for positioning, such as cell towers, Wi-Fi, and GPS. These multi-source positioning devices are harder to interfere with.