Kismet Wireless

Kismet Forums

 

Posted by:lorenzog
Subject:importing kismet data into gpsdrive's mysql database
Date:01:28:37 05/01/2006

greetings to everyone. I've been looking around but haven't found what I was looking for, so I'm asking here. Forgive me if it's an obvious question.

I'm trying to hack together a script to export data from a csv kismet output file and put it into a geoinfo database (such as one created by gpsdrive). Before I get mad, is there anyone who already did it in a more elengant way than mine?

Here's what I did 'til now, it's minimal but looks like it's working
(it inserts only name, lat, lon, type into mysql - no BSSID and such)
(also if there's a WEPd network whose name contains "None" it goes into the non-WEPd networks - should play more with grep, but it's late and I'm tired)
(besides that, that's it)

--- cut here ---

#!/bin/bash
# inserts data from kismet's CSV output files into gpsdrive's "geoinfo" database
#
# lorenzo g, <lorenzo.grespan@gmail.com> 2006 01 04
#

if [ "$1" == "" ] ; then
echo "provide the CSV kismet file"
exit 1
else
file=$1
echo "using $file"
echo "use geoinfo;" > /tmp/wp.sql

# looking for WEPd networks
echo -n "inserting WEPd networks..."
cat $file | grep WEP > /dev/null
if [ "$?" == 0 ] ; then
cat $file | grep WEP | awk -F\; ' { print "insert into waypoints (name,lat,lon,type) values (\"" $3 "\",\"" $33 "\",\"" $34 "\",\"WLAN-WEP\");" }' >> /tmp/wp.sql
echo "Done"
else
echo "no WEPd networks have been found..."
fi

# looking for non-WEPd networks
echo -n "inserting non-WEPd networks..."
cat $file | grep None > /dev/null
if [ "$?" == 0 ] ; then
cat $file | grep None | awk -F\; ' { print "insert into waypoints (name,lat,lon,type) values (\"" $3 "\",\"" $33 "\",\"" $34 "\",\"WLAN\");" }' >> /tmp/wp.sql
echo "Done"
else
echo "no non-WEPd networks have been found..."
fi

# done, insert into mysql
mysql -u gast -pgast < /tmp/wp.sql
echo "data from $file inserted into database geoinfo"
fi


Reply to this message