Wardriving using an Ubuntu 10.04 notebook and a Garmin Etrex

Wardriving

Most GPS software that ships with Ubuntu 10.04 uses gpsd to retrieve data from the GPS receiver. So make sure that you have gpsd installed. Unfortunately the new JSON protocol used by gpsd is not supported by some applications. You need to install Kismet 2011 or later. Get the deb packages from here: http://www.kismetwireless.net/download.shtml

Furthermore you’ll want to install GpsDrive 2.11 or later. Get the deb packages here: http://download.osgeo.org/livedvd/data/gpsdrive/lucid/ Be sure to literally follow the installation instructions in the README file or you’ll end up in dependency hell.

Set the interface of the Garmin to NMEA: SETUP -> INTERFACE -> NMEA OUT. (As a matter of fact we once managed to get things working over the Garmin protocol with the garmin_gps kernel module, but for some reason we did not succeed in reproducing that success. Besides, the garmin_gps module reportedly is unstable.) Connect the receiver via the USB-to-serial adapter and make sure that it is recognized:

pygmalion@anthemis:~$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[...]

You should now have a device like this:

pygmalion@anthemis:~$ ls -ltr /dev/ttyU*
crw-rw---- 1 root dialout 188, 0 2011-02-02 09:39 /dev/ttyUSB0

Start the GPS daemon in the foreground with some debugging options so that you can see what happens:

gpsd -nND4 /dev/ttyUSB0

Verify the functionality by starting xgps. It should report all available satellites and your current position.

GpsDrive uses a MySQL database for storage of waypoints. Create a database ‘geoinfo’ with a user ‘gast’ and password ‘gast’:

sudo geoinfo --create-db

Waypoints are retrieved from a textfile in your home directory: ~/.gpsdrive/way.txt
Unfortunately the current version of Kismet doesn’t appear to be able to create this file for you. (If you know better, feel free to post your solution below.) You can use some Python code to generate it from Kismet’s .netxml log:

#!/usr/bin/env python
 
import sys, xml.dom.minidom
 
f = open("/home/pygmalion/.gpsdrive/way.txt", "w")
filename = sys.argv[1]
document = xml.dom.minidom.parse(filename)
networks = document.getElementsByTagName("wireless-network")
for network in networks:
   try:
      essid = network.getElementsByTagName("essid").item(0).firstChild.data
   except:
      essid = "[cloaked]"
   lat = network.getElementsByTagName("peak-lat").item(0).firstChild.data
   lon = network.getElementsByTagName("peak-lon").item(0).firstChild.data
   f.write(essid + "\t" + lat + " " + lon + "\n")
f.close()

You may want to loop through this code during your wardrive:

pygmalion@anthemis:~$ while true
> do
> python/kismet_waypoints.py `ls -1t *netxml | head -1`
> sleep 60
> done

Start Kismet and GpsDrive with the Python script running and the wireless access points should appear on the map.

Kismet
GpsDrive

Use your creativity to extract more interesting information from the Kismet log files.

KML

You can use this Perl script to convert your data to KML: https://github.com/exp/Kismet-to-KML

Make sure to have libxml-generator-perl installed. Furthermore, install module Data::Dump as follows:

sudo perl -MCPAN -e shell
cpan[1]> install Data::Dump
Kismet data in Google Earth

One thought on “Wardriving using an Ubuntu 10.04 notebook and a Garmin Etrex”

Comments are closed.