2

My next project consists of a Raspberry Pi discreetly connected to a car that will wardrive for the person who connected it and never has to be retrieved. This is a proof of concept as I just want to show what the government might be able to do if we all have WiFi radios in our car one day.

It will start Kismet at boot and log the access point locations with a GPS receiver. Then, after a designated period of time, stop scanning, wait until it finds an open wireless network (car is stationery, perhaps parked at a coffeeshop) and then upload the kismet .netxml file to an FTP server or email it.

I don't know how to accomplish the final part. How can I stop Kismet scanning after a given time period, connect to an open network, and email the most recent kismet log file?

3
  • 1
    Looks like I'm just going to learn some bash scripting! Jul 28 '14 at 4:40
  • I'm curious why you need to shut kismet off, can you not connect to AP's when it is running? If the GPS detects you're not moving for a period of time (say 10 minutes) AND no new access points have been detected in the last minute.. go ahead and log out of kismet and do your upload. If you detect movement again.. halt the upload and return to kismet.
    – Erik
    Jul 30 '14 at 0:33
  • Can't connect while Kismet is running because the wireless card would be in monitor mode. Jul 30 '14 at 1:24
2

I feel your pain!

Thankfully I managed to get half a script done so hopefully you can or others can use it.

#!/bin/sh /etc/rc.common
# Kismet server init script
# Copyright (C) 2015 Springboard Research Limited

START=97
STOP=98

start() {
        echo "checking monitor interface"
        if [iw dev mon0 info | grep -q "Interface"]; then
                echo "Monitor found, deleting and recreating"
                ifconfig mon0 down
                iw dev mon0 del
                if [iw dev mon0mon info | grep -q "Interface"]; then
                        ifconfig mon0mon down
                        iw dev mon0mon del
                fi
                iw phy phy0 interface add mon0 type monitor
                echo "Bringing monitor interface online"
                ifconfig mon0 up
        else
                echo "Adding new monitor interface"
                iw phy phy0 interface add mon0 type monitor
                echo "Bringing monitor interface online"
                ifconfig mon0 up
        fi

        echo starting kismet server
        kismet_server -s -T netxml,pcap
}

stop() {
        echo "stopping kismet server"
        killall kismet_server

        echo "deleting the monitor interfaces"
        ifconfig mon0 down
        iw dev mon0 del
        ifconfig mon0mon down
        iw dev mon0mon del
}

Its pretty straightforward. There is a boot script that runs and starts up Kismet if its not running. In the script I had to taken down the monitor interface to execute the second script which checks file size and then uploads the file to an ftp server.

#!/bin/bash

# get the latest kismet capture file in the /tmp directory

KISMETCAPFILE=$(ls -dt Kismet-* | head -1)

# TEST: echo $KISMETCAPFILE

# check the file size

KCFILESIZE=$(stat -c%s $KISMETCAPFILE)
THFILESIZE=1000000
HOST="your_ftp_server"
USER="ftp_username"
PASSWD="ftp_password"
REMOTEPATH="/"

# TEST: echo $K_C_FILESIZE

if [ ! -z $KISMETCAPFILE ]; then
   if [ ! -z $KCFILESIZE ]; then
      # check file size
      if [ $KCFILESIZE >= $THFILESIZE ]; then

      # if above threshold then stop capture
      echo "stopping the capture"
      #/etc/init.d/kiss stop

      # export file to FTP server
      echo "exporting the file to the ftp server"
      ftp -in <<EOF
       open $HOST
       user $USER$PASSWD
       cd $REMOTEPATH
       put $KISMETCAPFILE
       close
       bye
EOF

      echo "uploaded file to $HOST:$REMOTEPATH"

      # delete local file

      echo "TEST: delete local file"

      # start capture

      echo "TEST: start capture"

      fi
   fi
fi

Hope the above helps someone.

1
  • Wanted to share some knowledge. I haven't touched Kismet for a long time but I found that with my particular device if I didn't enable the monitor but allowed it to channel hop the Kismet was able to scan all channels and get more data.
    – Trevor
    Oct 11 '16 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.