Raspberry War Pi

The gear needed for wardriving

3 posts • Page 1 of 1

Postby Andr0idian » Tue Sep 13, 2016 2:29 pm

I'm using the Raspberry Pi 3; it has onboard Bluetooth.

I've been tinkering a bit with my Raspberry pi. I managed to somehow fry my gps unit and it won't lock, so I've tied into my phone to use it's gps instead. I think the 4 feet apart they are in the car is an acceptable margin of error.

For the phone (host) I used:
https://play.google.com/store/apps/deta ... .GpsOverBt

Run the app and let it hum along. I changed my device's discoverability time to make it easier.

I won't bother plagarizing properphatboy's post over at raspberrypi.org forums, so I'll just drop the link:
https://www.raspberrypi.org/forums/view ... 9&p=234809

Follow his steps for the most part, but where he references someone else to configure the gpsd, what I had to do was edit the gpsd conf file... which doesn't have .conf for some reason.

Code: Select all

sudo nano /etc/default/gpsd
I changed the device from /dev/ttyAMA0 to /dev/rfcomm0 ... so it looks like the following:

Code: Select all

Default settings for the gpsd init script and the hotplug wrapper. # Start the gpsd daemon automatically at boot time START_DAEMON="true" # Use USB hotplugging to add new USB devices automatically to the daemon USBAUTO="false" # Devices gpsd should collect to at boot time. # They need to be read/writeable, either by user gpsd or the group dialout. DEVICES="/dev/rfcomm0" # Other options you want to pass to gpsd GPSD_OPTIONS=""
Restarted bluetooth, gps and started the gpsd client to see if I had a lock, and I'm in business :)

Code: Select all

sudo /etc/init.d/bluetooth start cgps -s
... Once it disconnects it won't reconnect automatically. Something I'm working on.
Image

Postby Andr0idian » Thu Sep 15, 2016 5:48 am

Fixed my gps. Turns out I had a broken ground on my antenna, so I'm back to the wired unit... much better.

Figured I'd share a few more braindroppings for anyone that needs idea fodder.

I learned the best way to edit your crontab is by this... very handy instead of editing the files directly.

Code: Select all

crontab -e

Code: Select all

# m h dom mon dow command */10 * * * * sudo /home/pi/kismet/restartsize.sh 0 4 * * * /home/pi/kismet/wigleupload.sh @reboot sleep 600 && /etc/timeset.sh @reboot vncserver # @reboot ifconfig eth0:1 192.168.2.17/24 up
Basic explanation:
Every 10 minutes restartsize.sh: check to see if the gpsxml file is getting close to a size limit, and restarts Kismet.
4am wiglupload.sh: daily zip everything up and queue it for upload... then try to upload it.
At boot time, timeset.sh: sleep for 10 minutes then set the time off of the gps. -- this is sloppy AF but its the only way I've found that works.

restartsize.sh:

Code: Select all

#!/bin/bash #Checking for maximum filesize. for f in /home/pi/kismet/capture/Kismet* do minimumsize=70000000 actualsize=$(wc -c <"$f") if [ $actualsize -ge $minimumsize ]; then echo OVER $f stopping kismet sudo service kismet stop mv /home/pi/kismet/capture/Kismet* /home/pi/kismet/capture/tozip sudo service kismet start fi done echo $(date +%Y%m%d_%H%M%S) >> /home/pi/kismet/sizelog.txt #If there's enough files to justify an upload, zip and send them. numfiles=$(ls -l /home/pi/kismet/capture/tozip | wc -l) echo $numfiles is how many files we got so far. if [ $numfiles -ge 50 ]; then Echo too many ./wigleupload.sh fi
wigleupload.sh:
Note: To make the upload work properly, you'll need your cookie from the site in cookies.txt ... and change your observer= at the bottom.

Code: Select all

#!/bin/bash #Change user to your username. user=Andr0idian file=$user"_$(date +%Y%m%d_%H%M%S)" echo Stopping Kismet sudo service kismet stop echo Moving files for compression mv /home/pi/kismet/capture/Kismet* /home/pi/kismet/capture/tozip/ echo Restarting Kismet sudo service kismet start echo zipping files for export #zip and delete kismet files # Flags: J, dont record directory names, 9 is maximum compression - decreases size another 8% or so, m is move into zip - or delete after compression zip -j -9 -m /home/pi/kismet/toupload/$file /home/pi/kismet/capture/tozip/Kismet* echo Files to upload: $(ls -l | wc -l) for f in /home/pi/kismet/toupload/* do echo uploading $f curl --cookie cookies.txt --form stumblefile=@$f --form Send=Send --form observer=Andr0idian https://wigle.net/upload > /dev/null && echo $f \ completed successfully. Moving to archive && mv $f uploaded || echo $f failed to upload: $? done
timeset.sh:

Code: Select all

#!/bin/bash GPSDATE=$(gpspipe -w -n 10 | grep TPV | sed -r 's/.*"time":"([^"]*)".*/\1/' | tail -n 1 | sed -e 's/^\(.\{10\}\)T\(.\{8\}\).*/\1 \2/') echo $GPSDATE date -u --set="$GPSDATE"
...
I also sloppily made kismet a service.

IF you use this, make sure you change the /usr/local/bin/kismet_server -F flag to wherever your kismet.conf is, or you're going to have a bunch of crap dumped into your init.d directory (oops)

/etc/init.d/kismet:

Code: Select all

#!/bin/sh ### BEGIN INIT INFO # Provides: kismet # Required-Start: $all # Required-Stop: $local_fs $remote_fs $syslog $network # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start kismet at boot time # Description: Starts kismet at boot time ### END INIT INFO case "$1" in start) echo "Starting kismet" #/bin/sleep 30 /usr/local/bin/kismet_server --daemonize -F /usr/local/etc/kismet.conf ;; stop) echo "Stopping kismet" killall kismet_server ;; *) echo "Usage: /etc/init.d/kismet start|stop" exit 1 ;; esac exit 0
and enable it:

Code: Select all

systemctl kismet enable
That's my $0.02 for the day.
Image

Postby mdkFree » Mon Dec 19, 2016 12:38 pm

Thanks, I think I will incorporate this into my setup. My issues are mainly files getting too large to process, and manual uploading. Currently I use an official raspberry pi display. to start scanning and to monitor.

Would like to see a webclient for kismet running on the pi to monitor wirelessly

3 posts • Page 1 of 1

Return to “Net Hugging Hardware and Software”

Who is online

Users browsing this forum: No registered users and 35 guests