Sinto sua dor!
Felizmente, consegui fazer meio script para que você ou outras pessoas possam usá-lo.
#!/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
}
É bastante simples. Existe um script de inicialização que executa e inicializa o Kismet se não estiver sendo executado. No script, tive que remover a interface do monitor para executar o segundo script que verifica o tamanho do arquivo e, em seguida, envia o arquivo para um servidor FTP.
#!/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
Espero que o acima ajude alguém.