Jump to content

Setting system time using GPS NMEA 0183 strings?


Recommended Posts

Anyone know of a fancy set of commands that would allow me to set the system time based on the incoming GPS data while running kismet_server?

I have it set up to run using the DIP switches but the system time is always 01/01/2014 00:00. I'd like for the file names to be correctly labeled and also have correct time info for when AP's are seen. I'm also going for portability so I'd really like to not have to SSH in and enter it in manually every time I plug it in.

This is my current boot config:

ifconfig wlan1 down; iwconfig wlan1 mode monitor; ifconfig wlan1 up; sleep 5; kismet_server

Any ideas?

Link to comment
Share on other sites

Well I figured it out. I stumbled across a post by dvarapala about warwalking and he posted his script which happens to do the exact thing that I want :)

https://forums.hak5.org/index.php?/topic/33855-warwalking-redux-and-a-question/

#!/bin/bash

# START CLEAN
pkill hostapd
pkill gpsd
pkill kismet
/sbin/ifconfig wlan0 down
/sbin/ifconfig wlan1 down

# START GPSD
/usr/sbin/gpsd -n /dev/ttyUSB0

# WAIT UNTIL IT'S READY TO ACCEPT CLIENT CONNECTIONS
sleep 1

# MONITOR GPS STATUS AND WAIT FOR SAT LOCK
gpspipe -w | grep -qm 1 '"mode":3'

# PARSE THE CURRENT UTC TIME FROM THE GPSD OUTPUT
UTCDATE=`gpspipe -w | grep -m 1 "TPV" | sed -r 's/.*"time":"([^"]*)".*/\1/' | sed -e 's/^\(.\{10\}\)T\(.\{8\}\).*/\1 \2/'`

# SET THE PINEAPPLE'S CLOCK
date -u -s "$UTCDATE"

# LAUNCH KISMET DAEMON
/usr/sbin/iwconfig wlan0 mode Monitor
/usr/sbin/iwconfig wlan1 mode Monitor
/usr/bin/kismet_server --daemonize

I was having problems with gpspipe, it just would not work. I used opkg to uninstall and reinstall, but it still would not work. I ended up reflashing the firmware and starting fresh. It works like a charm now :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...