Saturday, June 29, 2019

My first domain.

Well. It's 2019 and I bought my first domain. So here we are.

Tuesday, November 22, 2016

HackRF One: GPS Simulation

Here we go. I have been meaning to make this post for a while now. I have parts needed and worked through some bumps to get this working. It keeps it pretty localized, approximately 15 foot range with line of sight.

WARNING! MAY BE ILLEGAL IN YOUR AREA. Check all regulations that apply to you. I am not responsible for your actions. Don't be that guy/gal, keep it in safe test environments.

Software:

Linux SDR distribution. I use Kali and installed the SDR tools.

apt update && apt upgrade -y && apt dist-upgrade -y && apt install kali-linux-sdr

https://github.com/osqzss/gps-sdr-sim

http://www.labsat.co.uk/index.php/en/free-gps-nmea-simulator-software

Hardware:

1x HackRF One https://hakshop.com/collections/wireless-gear/products/hackrf?variant=701314117

1x Board design https://github.com/osqzss/gps-sdr-sim/tree/master/extclk
1x TCXO http://www.digikey.com/product-detail/en/FOX924B-10.000/631-1067-1-ND/1024772

1x Ceramic Capacitor http://www.digikey.com/product-detail/en/murata-electronics-north-america/GRM219R61A105KA01D/490-5760-1-ND/2771955

1x Header Pins http://www.digikey.com/product-detail/en/amphenol-fci/67997-412HLF/609-3244-ND/1878517

1x Passive Antenna for GPS http://www.digikey.com/product-search/en?keywords=TS.07.0113

1x 30 db RF attenuator. I purchased one off ebay. Specs: SMA male - SMA Female, 30 dB, 50 Ohm, 2W max power, DC to 6 GHz

Soldering Iron, Flux, Solder, etc.

Optional (Same part):

Getting it working:

Construct the board using the pictures from the github as a reference: https://github.com/osqzss/gps-sdr-sim/blob/master/extclk/hackrf_tcxo.jpg

Connect your RF attenuator and GPS antenna to the HackRF.

After you have checked all your solder joints for the external clock, see if the hackRF will detect the clock via https://github.com/mossmann/hackrf/wiki/HackRF-One

Quote

External Clock Interface (CLKIN and CLKOUT)

HackRF One produces a 10 MHz clock signal on CLKOUT. The signal is a 10 MHz square wave from 0 V to 3 V intended for a high impedance load.
The CLKIN port on HackRF One is a high impedance input that expects a 0 V to 3 V square wave at 10 MHz. Do not exceed 3.3 V or drop below 0 V on this input. Do not connect a clock signal at a frequency other than 10 MHz (unless you modify the firmware to support this). You may directly connect the CLKOUT port of one HackRF One to the CLKIN port of another HackRF One.
HackRF One uses CLKIN instead of the internal crystal when a clock signal is detected on CLKIN. The switch to or from CLKIN only happens when a transmit or receive operation begins.
To verify that a signal has been detected on CLKIN, use hackrf_debug --si5351c -n 0 -r. The expected output with a clock detected is [ 0] -> 0x01. The expected output with no clock detected is [ 0] -> 0x51.
Git clone https://github.com/osqzss/gps-sdr-sim and follow the instructions to compile.

Go into the satgen directory and run make as well.

Download a brdc*.*n.Z from ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2016/brdc/  https://cddis.nasa.gov/archive/gnss/data/daily/2021/ and unzip the file.
In order to get this working with the HackRF, you need to use the -b flag with a value of 8. Here is a modified example from the github page:

./gps-sdr-sim -b 8 -e brdc3540.14n -l 37.808880,-122.410167,216 -o StaticLocation.bin

This runs the program using -b 8 for the HackRF, -e for the historic GPS ephemeris data (This cannot do current day, but yesterday's compiled file should work. Read up more on that if you are interested.), -l for gps location and the last number is the altitude in meters, -o for output.bin file. The max duration for gps-sdr-sim is 300 seconds. If you use the default/max 300 seconds, it will generate a ~1.5 GB output.bin file. Keep this in mind if you are saving multiple locations. If you forget to use the -o option, it will create gpssim.bin.

From there you can broadcast that .bin file with HackRF using the following command:

hackrf_transfer -f 1575420000 -s 2600000 -a 1 -x 0 -R -t StaticLocation.bin
Use hackrf_tansfer -h to know what all the options do.

You may notice that your phone will not accept the GPS broadcast. The first thing to do is enable "Device Only" GPS mode. Do not use High Accuracy. I also had to use an app (GPS Status) in order to clear my A-GPS cache. Then I use a different app (GPS Test) in order to see if my phone gets a GPS lock. I usually leave the phone in airplane mode with WiFi turned off in order for GPS Status to clear the cache and not auto-download A-GPS data. Then I will run GPS Test and wait for a lock before turning on WiFi.

Garmin GPS units and similarly other devices shouldn't have an issue detecting your GPS signals.

Creating Paths:

You can create a path using Google Earth and saving out the path into a KML. Using that SatGen program, you can load the KML and it will show you some options you can manipulate, and also a crude picture of your path.



You can manipulate some of the options to your liking and hit the preview button to have it refresh and show your new speed graph. When you are happy, click "Generate NMEA" and save that file.
Move that file over to the gps-sim-sdr/satgen directory and run the program which you should have compiled earlier to convert the NMEA to a user motion file for gps-sdr-sim.

./nmea2um 
Usage: nmea2um <nmea_gga> <user_motion>
Once you have your user motion file created. You can use that in the gps-sdr-sim using the -u option.

./gps-sdr-sim -b 8 -e brdc2980.16n -u Hak5_Usermotion -o Hak5example.bin
Notice the total time at the bottom of the SatGen program 111.40 seconds. You will need to keep it under 300 seconds to work with gps-sdr-sim. You can modify gps-sdr-sim to increase the max number of seconds by editing USER_MOTION_SIZE in gpssim.h and then recompile with gcc. Use caution as this will allow you to create very large files. The default of 300 seconds caps approximately 1.5 GB.

From there it's a matter of transmitting the .bin file like before.

hackrf_transfer -f 1575420000 -s 2600000 -a 1 -x 0 -R -t Hak5example.bin

Cheers!

Monday, December 2, 2013

WiFi Pineapple Mark IV - Clean Flash UART

Mark IV Clean Flash over Serial (UART)


Attention!

DO NOT USE ON BATTERY POWER!
Always use the AC Adaptor.

Why you would want to clean flash


  • Because you somehow bricked your pineapple
  • You have a new Hornet-UB (Hornet-UB only has the bootloader, no OpenWRT)

Where to connect the UART

To open the Pineapple/Jasager/AP121U, you will need to remove the 2 rubber stoppers on the bottom of the device to reveal 2 screws. Remove the 2 screws and you should be able to wiggle it apart.

UART Adaptors

There are many USB/Serial to UART adapters out there. The author of the video below (Mr-Protocol) used the Alfa Console Board. Any 3.3v capable UART adapter should work. Check the adapter specifications before buying. You can also buy a UART Adaptor from the Hakshop.

If you are not using the Alfa Console Board, You only need to hook up the TX, RX, GND pins to your UART adapter. DO NOT hook up the VDD pin to your adapter.



Hardware Used


  • Alfa Console Board Or any USB-UART 3.3v Adapter
  • Serial Cable from PC to Alfa Console Board (If you are using a serial port on PC and the Alfa Console Board)
  • Ethernet Cable
  • AC Power Adapter
  • WiFi Pineapple (AP121U)(Hornet-UB PCB

For non-Alfa Console Board hookup

UART RX Pin —– Hornet TX Pin
UART TX Pin —– Hornet RX Pin
UART GND Pin —– Hornet GND Pin
(Take note of the cross between RX-TX)
DO NOT plug in the voltage pin.

***Depending on how the UART manufacturer labeled TX and RX, you may need to swap them if you don't see data in your terminal session.***

Software Tools (Windows)


Software Tools (Linux/*buntu)


  • tftpgui - Simple tftp server. Make sure you have the correct Python dependencies installed for the one you download. Read the readme file to understand how to use it. Extract tftpgui, then extract factoryFiles.tar to the tftpgui/tftproot/ directory. sudo python tftpgui –nogui
  • scp
  • Minicom or your favorite serial terminal. Read the man page for setting baud and other options. sudo minicom -w -s
  • Hornet-UB Factory Firmware (Files)
  • Latest Mark IV Firmware

Instructions

Setup


  • Download Hornet-UB Factory Firmware (Files)
  • Extract the factory files and set up a tftp server (tftpgui, tftpd32, etc.) that points to the files.
  • Setup your computer to allow scp. For Windows: WinSCP
  • Connect to your pineapple through serial. Serial Settings: 115200 baud, 8 data bits, no parity, 1 stop bit, no flow control.
  • Connect via the pineapples PoE/LAN port (the one closest to the power plug) with your computer's IP set to 192.168.2.11

Apply Power and Configure

When the bootmenu shows up, Press '1'

Execute these commands :
setenv bootargs "board=ALFA console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd"
saveenv
tftp 0x80600000 kernel.bin
erase 0x9f650000 +0x190000
cp.b 0x80600000 0x9f650000 d695a
tftp 0x80600000 rootfs.bin
erase 0x9f050000 +0x600000
cp.b 0x80600000 0x9f050000 23d004
bootm 0x9f650000
reboot

If you see kernel panics, start over.
Wait for the pineapple to boot then hit enter, you will drop into the OpenWRT Shell.

Change the root password and start the SSH server

Change the root password
passwd

Start the SSH server

/etc/init.d/dropbear start

Installing Firmware

scp over the firmware to /tmp/
scp upgrade.bin root@172.16.42.1:/tmp/
and perform the upgrade.
sysupgrade -n -v /tmp/upgrade.bin

At this point, the Jasager firmware is being installed. When it's finished and you have a command prompt:
reboot

Post-Installation

Enjoy your new pineapple!, Learn all about it by reading the manual and visit the forums to use your pineapple.

Clean Flash Videos

Windows Clean Flash Video by Mr-Protocol :
(YouTube link: http://www.youtube.com/watch?v=i58XOF4Rfc4)

Monday, October 1, 2012

DerbyCon 2012

Just wanted to throw out there a big thanks to everyone I spoke to at DerbyCon. It was a great experience and can't wait until next year!

Wednesday, August 8, 2012