Some simple examples of how to extend data collected from kismet along with gpsd. The prgram gpsmap, bundled with kismet, can create excellent maps of wifi networks, albeit not in a georeferenced format. With some ideas from Matt Perry, a quick read through some python docs, and a little testing I put together a simple python script (kismet2shp) which will convert Kismet XML logfiles into a shapefile (see attached file at bottom of page for the source). Conversion from kismet logfile to KML was demonstrated in the above article by Matt. Simple usage of kismet2shp is summarized:

 # range polygons
./kismet2shp -r -s --file=Kismet-Sep-03-2006-1.xml --outfile=range.shp
#
# network centers (points)
./kismet2shp -s --file=Kismet-Sep-03-2006-1.xml --outfile=points.shp  

Output can either be in the default latlong WGS84 GCS, or in some user defined projected coordinate system (see source code). Example images from gpsmap and from QGIS demonstrate similarities. The important difference is that by converting Kismet data into a shapfile, it is possible to bring this information into a GIS. A simple example below demonstrates how one can compute an estimated signal power index in GRASS, similar to the interpolated power option in gpsmap. The power density index is calculated as the summation of [ 1/(range^2) ] for each network center.

Make simple maps with gpsmap

 #interpolated power map
gpsmap -S 2 -e -n 1 -t -l ssid  -k -p -Q 20 -q 2 -P 30 -z 2 -d 1000,1000 \
-o map1.png Kismet-Sep-03-2006-1.gps
#range map
gpsmap -e -n 1 -t -l ssid  -k -r -R 15 -q 2 -d 1000,1000 \
-o map1.png Kismet-Sep-03-2006-1.gps

Estimate signal power density in GRASS

 #prep work:
#import data from kismet2shp:
v.in.ogr dsn=. layer=points out=wp
#setup a resonable resolution
g.region vect=wp res=10 -a
#init a constant value surface for distance calculation
r.mapcalc "z = 1"
#init power level map
r.mapcalc "a = 0.000"
#
#create a list of networks
cats=`v.db.select wp -c  colum=cat`
#loop thru list of networks
for i in $cats
do
v.extract in=wp out=wp_i list=$i --o > /dev/null
#get this network's estimated range
range_i=`v.db.select wp_i -c colum=range`
#compute distance map from network center to estimated range
r.cost -k in=z out=c_i start_points=wp_i max_cost=$range_i --o > /dev/null
#convert distance from net center to power index
r.mapcalc "c_i_f = if( isnull(c_i) != 1,  1/(float(c_i)^2) , null())" > /dev/null
#add to previous power estimation
r.mapcalc "a = if( isnull(c_i_f) != 1, a + c_i_f, a)" > /dev/null
done
#remove the weakest power levels
r.mapcalc "a = if( a < 0.5,  null(), a)" > /dev/null
#fix colors
r.colors map=a color=gyr

gpsmap-range.preview.jpg
gpsmap range: network range as visualized with gpsmap

gpsmap-power.preview.jpg
gpsmap power: interpolated power density from gpsmap

ogr-python_range.preview.jpg
qgis range: network range shapefiles visualized in QGIS

grass-power.preview.jpg.png

GRASS power density: simple index of wifi signal power computed in GRASS

A mobile wifi mapping setup might include:

Planned work:

  • Modifications to kismet-earth to improve merging of multiple .gps files
  • enhanced wifi network center estimation, and power interpolation with GIS tools

Attachment:

kismet2shp.py_.txt

Links:

Geologic-Scale Erosion

Raster Operations

Simple Comparison of Two Least-Cost Path Approaches