Mapping Wifi Networks with Kismet, GDAL, and GRASS
Sep 7, 2006 metroadminSome 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.shpX
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 mapgpsmap -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 mapgpsmap -e -n 1 -t -l ssid -k -r -R 15 -q 2 -d 1000,1000 \-o map1.png Kismet-Sep-03-2006-1.gpsX
Estimate signal power density in GRASS
#prep work:#import data from kismet2shp:v.in.ogr dsn=. layer=points out=wp#setup a resonable resolutiong.region vect=wp res=10 -a#init a constant value surface for distance calculationr.mapcalc "z = 1"#init power level mapr.mapcalc "a = 0.000"##create a list of networkscats=`v.db.select wp -c colum=cat`#loop thru list of networksfor i in $catsdov.extract in=wp out=wp_i list=$i --o > /dev/null#get this network's estimated rangerange_i=`v.db.select wp_i -c colum=range`#compute distance map from network center to estimated ranger.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 indexr.mapcalc "c_i_f = if( isnull(c_i) != 1, 1/(float(c_i)^2) , null())" > /dev/null#add to previous power estimationr.mapcalc "a = if( isnull(c_i_f) != 1, a + c_i_f, a)" > /dev/nulldone#remove the weakest power levelsr.mapcalc "a = if( a < 0.5, null(), a)" > /dev/null#fix colorsr.colors map=a color=gyrX
gpsmap range: network range as visualized with gpsmap
gpsmap power: interpolated power density from gpsmap
qgis range: network range shapefiles visualized in QGIS
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:
Links:
Geologic-Scale Erosion
Raster Operations
Software
- General Purpose Programming with Scripting Languages
- LaTeX Tips and Tricks
- PostGIS: Spatially enabled Relational Database Sytem
- PROJ: forward and reverse geographic projections
- GDAL and OGR: geodata conversion and re-projection tools
- R: advanced statistical package
- GRASS GIS: raster, vector, and imagery analysis
- Generic Mapping Tools: high quality map production