gpsdrive, kismet and gpsmap HOWTO


How exactly the fluff does one make nice pretty maps of one's wardriving activity using Linux/FOSS?

Hello! Well, if you're here, I guess you've found the wonders of wardriving, and also the wonders of Linux/FOSS. But, how in the world do you use these wonders to make nice pretty maps like this one? **FIXME** THIS HOWTO IS ALPHA-QUALITY; VERSION 20040607

The answer is: with gpsdrive, kismet, and gpsmap. But the devil is in the details!

First, you should know there are two ways you can get maps with wifi information on them. You can either do it in real-time with gpsdrive, or you can create the maps after you've finished wardriving using gpsmap, or you can do both. I will cover both ways in this HOWTO.

I'm going to assume you're using either Knoppix or Debian. Knoppix includes all the software you need on the CD, and if you're using Debian, you can easily apt-get what you need. If you're using a different distro or even operating system, that's OK! Just install the programs you need via your distro's own methods (like rpm) or from source. Installing with rpm or from source is outside the scope of this document.

You need just a couple of things. First, of course, you need the hardware:
  1. A laptop. Mine is an old Toshiba Celeron 600 with 64 megs of RAM.
  2. A compatible wifi card. (See kismet's documentation for details on which cards you can use on which operating systems)
  3. A GPS device that can hook into your laptop. Mine is a Deluo USB which I got off ebay for like 80 bucks. Watch out that connector, btw, I had to resolder mine when it came loose...
That's about it for hardware. Next, you need the software. Here is what you need to get started:
  1. Linux. I use Knoppix on my laptop and straight Debian on my workstation. Yes, I do run Knoppix live from the CD! It really does work. If you're feeling brave you could also try FreeBSD, OpenBSD, NetBSD, or even Mac's OS X.
  2. Wifi drivers. You need your wifi card to work with linux. Knoppix auto-detected mine (a Netgear Prism2) without any problems; please refer to resources particular to your card for more information. The affore mentioned kismet documentation is a good place to start looking if you need some help.
  3. GPS drivers. Again, your GPS must work with linux (or your OS). If you have a USB model, the driver you need is probably one of the usbserial ones. For my Deluo, the proper driver is pl2303. Knoppix loaded the proper driver automatically as soon as I plugged my GSB unit in; if you need help, please consult your GPS's documentation or use google.
Once you've got Linux running with your wifi card and your GPS, you can get really going:
  1. gpsdrive. gpsdrive handles the gps and the maps for you.

    You use gpsdrive to control your gps and grab the maps you need. You can also show your position and plot hotspots in real time while driving.

    gpsdrive includes gpsd (the gps daemon), which provides gps data to both gpsdrive and kismet. gpsdrive also includes **FIXME**, which can do fast mass-map downloading, which is nice if you need to have detailed maps for a large area before you head out. NB: As of June 2004, the gpsdrive in debian testing includes a NON-WORKING The package in unstable (gpsdrive/unstable 2.09-1) has a working version, or you can download it from me here **FIXME**.

    Knoppix comes with gpsdrive, so if you have Knoppix, you are good to go. If you are using debian, do an "apt-get install gpsdrive" as root.

  2. kismet. You use kismet to control your wifi card.

    kismet scans the airwaves for wifi signals and logs any networks it finds. kismet uses gpsdrive's gpsd for gps information, and it can report any networks it finds to gpsdrive for real-time plotting. kismet also includes gpsmap, which you can use to make pretty maps of your wardriving activity after you're done wardriving.

    Knoppix comes with kismet. If you are using debian, do an "apt-get install kismet" as root.

  3. mysql. You need mysql if you want gpsdrive to plot wifi networks in real-time as you drive. If you don't care about this, you can create nice maps after the drive with gpsmap. I have created a separate page to deal with mysql installation **FIXME**.
After you install gpsdrive, kismet, and mysql, you need to set them up to work properly.

The next section deals with running Knoppix live from the CD. You need to do some important things for this to work: Mount your hard drive, copy your home directory to your hard drive, and copy some key config files to your hard drive. Please skip the next section if you are not running Knoppix live from the CD.

If you are running Knoppix live from the CD, you need to do a couple important things. First, you need to have read and write access to the hard drive. My old laptop has Windows 98 on its drive, so I can mount it using linux's fat driver. If your laptop has a newer Windows that uses NTFS, you need to use Knoppix 3.4 with the "Captive" NTFS read/write driver. Mounting your hard drive is beyond the scope of this document. I will assume you have mounted your hard drive to a mountpoint at /c . Please also note that I recommend the file access permissions be set to 777; world readable, writable, and executable, to eliminate errors that result from programs being unable to access their files. This can be accomplished with a umask=0 option to mount with fat. Please note that I actually do know what I am talking about here; I understand the security implications and I am not recommending this on a whim. mysql will fail to work if it cannot read and write to its database after it drops privileges, and setting permissions to 777 is the easiest way to fix this. An example of a mount command (what I use) is "mount -o uid=knoppix,umask=0 /dev/hda1 /c"

After you've mounted your hard drive, you need to do some other slightly tricky things. You will need to edit some config files, but those config files are stored on the CD and the CD is of course read-only. Therefore, you need to copy those files to your hard drive, remove them from the filesystem stored in ram, and either copy or link them back to the ramdisk filesystem from your hard drive. Also, your entire knoppix user's home directory must be on the hard drive.

Here are some step-by-step directions on how to set things up if you're using Knoppix live from the CD. If you are running from the hard drive, please skip this section.

  1. Mount your hard drive. Exact, specific instructions for doing this are beyond the scope of this document. With a laptop running Windows 95, 98, or ME, you can use:
    mkdir /c
    mount -o uid=knoppix,umask=0 /dev/hda1 /c

  2. Make a directory on your C drive for your knoppix user's home directory. (if your hard drive is not mounted at /c, replace /c with where your hard drive is mounted in this and future instructions):
    mkdir /c/home

  3. Copy your knoppix user's home directory to the hard drive:
    cp -vR /home/knoppix/* /c/home
    cp -vR /home/knoppix/.* /c/home

  4. Remove the knoppix user's home directory from the ramdisk filesystem:
    rm -rf /home/knoppix

  5. Link the knoppix user's home directory from the hard drive to the ramdisk filesystem:
    ln -s /c/home /home/knoppix

  6. Copy several key files and directories to the knoppix user's home directory, and link or copy them back to the ramdisk filesystem:
    cp -vR /var/lib/mysql /home/knoppix
    rm -rf /var/lib/mysql
    ln -s /home/knoppix/mysql/ /var/lib/mysql

    cp -vR /etc/kismet /home/knoppix
    rm -rf /etc/kismet
    ln -s /home/knoppix/kismet/ /etc/kismet

    cp -v /etc/init.d/mysql /home/knoppix/startmysql
    rm -f /etc/init.d/mysql
    ln -s /home/knoppix/startmysql /etc/init.d/mysql

    cp -v /etc/mysql/my.cnf /home/knoppix
    rm -f /etc/mysql/my.cnf
    cp -v /home/knoppix/my.cnf /etc/mysql
    chmod a-wx /etc/mysql/my.cnf

    cp -v /etc/hosts.allow /home/knoppix
    rm -f /etc/hosts.allow
    cp -v /home/knoppix/hosts.allow /etc

    cp -v /etc/X11/XF86Config-4 /home/knoppix/XF86Config-4.virtual
    rm -f /etc/X11/XF86Config-4
    cp -v /home/knoppix/XF86Config-4.virtual /etc/X11/XF86Config-4

  7. Now, you need to edit the config files to match your setup, and also create a script that sets up your system when you reboot. **FIXME**

Ok, we're done setting up Knoppix Live; and you've set up your kismet, mysql, and X config files correctly, and your knoppix user has proper permissions to your GPS device (should be already done with Knoppix) **FIXME*

Now, you need to start gpsdrive and configure it properly. Make sure you're logged in as the knoppix user (not root), and start X by typing startx.

Open up an xterm, and run gpsdrive by typing gpsdrive.

The gpsdrive window will come up, and it will be in simulation mode. Simulation mode just pretends it is getting input from the GPS. You need to configure gpsdrive: set up some default options, and tell it how to access your GPS.

Click on the Preferences button on the left side of the gpsdrive window. A setup window will pop up. This window has several tabs you need to configure.

Settings tab: Deselect Show Shadows: I find that shadows only get in the way, so I deselect them. Select which unit you prefer from miles, metric, or nautic. I prefer miles. Set the max CPU load: I set this to 90%. If you want, change the font to something you like.

Settings 2 tab: Select which server you want to use. I use Expedia USA. The maps directory should be /home/knoppix/.gpsdrive/ . If your GPS is Garmin, select Test for GARMIN, otherwise uncheck. My Deluo is not a Garmin, so I have this deselected. If your GPS outputs NMEA data, deselect Test for GARMIN. Set the Interface your gps is located at. My Deluo USB is at /dev/ttyUSB0 . If you have a serial GPS, you might try /dev/ttyS0 , /dev/ttyS1 , /dev/ttyS2 , or /dev/ttyS3 . A Baudrate of 4800 is sensible.

That should be all you need to set up. Go through the other tabs if you feel like checking them out.

Hit Close to save your settings.

Now, you need to start the gpsd. Click on the Start GPSD button on the left side of the gpsdrive window. gpsdrive will start gpsd and start reading information from your GPS.

Once your GPS has aquired a lock, gpsdrive will show your proper latitude and longitude at the bottom of the window. Now, you need to download a map of your area! Start out with a 1:20000 (twenty thousand, or 20,000) scale map. Select your scale preference by moving the scroll bar at the bottom right of the window. Make Pref. Scale read 1:20000.

Now, click the Download map button on the left side of the gpsdrive window. gpsdrive will color the area of the map to be downloaded in yellow, and bring up a dialog box to confirm the settings. Click on the Download map button in the dialog box, and gpsdrive will download the map and display it. You should recognize where you are!

Press the x key on your keyboard to create a waypoint for your current location. I'm assuming you're doing this at home; so make the Waypoint name home. Click Apply to save your home waypoint.

After you've marveled at the gps and the map, go ahead and quit gpsdrive by clicking the Quit button on the left side of the gpsdrive window.

You now need to download some maps around your home. You use the program that comes with gpsdrive to do this. Make sure you have a recent version, otherwise it will not work!

Use a command like the following: -w home -sc "5000,15000,30000,50000,200000,500000,3000000" -a 5 --mapserver expedia -u miles -p

Make sure -w matches your waypoint that you saved with gpsdrive; if you followed the instructions you should have a waypoint named home. -sc sets the scale for the maps you're downloading; the provided scale gives you quite a nice range of detail all the way up to a multi-state view. If you don't need so much, take out some. The 200000 scale map that we downloaded can be used as a starting point; if that was enough detail for you, remove the lower details. If you don't think you need street level view, remove some of the lowest scales. Remember: The more detail you need, the more maps you must download. Please consider that you may be violating Expedia's copyright by downloading a lot of maps.

The -a sets the amount of square miles from your waypoint to download. You probably don't need high detail for areas outside your home, so if you increase the area with -a, you may want to remove the lower scales.

After you have downloaded the maps you need, start kismet, and for real-time information,  start mysql and gpsdrive, go wardriving, and come home. **FIXME**

Once you come home, you need to determine which map you want to use to plot the networks you've found. Browse your .gpsdrive directory and find the map you want to use. Copy it to your home directory. Next, find the line with the name of that map in the map_koord.txt file in the .gpsdrive directory. Keep that line handy, you'll need it in the next step. Finally, rename your copied map file to something descriptive, like the name of your city or town or neighborhood. I use goldsboro.gif

kismet will have saved some information from your adventure. On my computer, kismet saves its information to /home/knoppix/kismetlog. To finally make that map, use gpsmap like this:
gpsmap -v -m goldsboro.gif -o goldsboro_wifi.gif -c 35.35765,-77.99655 -s 23700 -n 1 -G -e -t -Y 1 kismetlog/*.gps

This command takes the map file goldsboro.gif and outputs a file named goldsboro_wifi.gif. Copy the latitude and longitude information from that line in map_koord.txt and use it with -c lat,long . Copy the scale information from the line in map_koord.txt and use it with -s scale .

The -n 1 means color the networks according to WEP and default setups. The -G disables gray-scale (black and white) images. The -e means put a point on the map where ever kismet found a wifi network. The -t means put the track (where you traveled) on the map. The -Y 1 means make the track width 1 pixel. The kismetlog/*.gps is the path of your kismet log files, and it tells gpsmap to use all available gps information.

Now you have an image file named goldsboro_wifi.gif with a nice map of your wardriving adventure!

If you want a map that has the names of the networks, try this command:
gpsmap -v -m goldsboro.gif -o goldsboro_wifi_labeled.gif -c 35.35765,-77.99655 -s 23700 -n 1 -G -e -l name ../kismetlog/*.gps

Read the gpsmap man page for more information.

That's about it! Enjoy.