#!/bin/sh prefix=/home/darkness/wireless/root ETC=${prefix}/etc bindir=$prefix/bin set -m gui=`grep -e "^gui=" $ETC/kismet_ui.conf | cut -d= -f2 | tr -d [:space:]` if test "$gui" = ""; then echo "No gui specified in $ETC/kismet.conf. Please specify one!" exit fi mode="server" while test "$1" != ""; do if test "$1" = "-h"; then echo "$0 [server options] -- [client options]" echo "ex: $0 -c prism2 -p 5000 -- -q -p 5000" echo "to start the server with a prism/2 capture source on port 5000 and start the" echo "client in quiet mode on the same port." exit elif test "$1" = "--"; then mode="client"; elif test "$mode" = "server"; then server="$server $1" elif test "$mode" = "client"; then client="$client $1" fi shift done if test "$server" = ""; then echo "Server options: none" else echo "Server options: $server" fi if test "$client" = ""; then echo "Client options: none" else echo "Server options: $client" fi echo "Starting server..." sudo sh -c $bindir'/kismet_server --silent $server & echo $!' #servpid=$! servpid=`/sbin/pidof kismet_server 2>&1` echo "kismet_server pid: $servpid" sleep 1 echo "Starting UI..." $bindir/kismet_curses $client if test "$?" != "5"; then echo "Killing server..." sudo kill $servpid wait %- fi echo "Terminating..." if test -f "/var/run/kismet_hopper.pid"; then HOPPERPID=`cat /var/run/kismet_hopper.pid` echo "Shutting down kismet_hopper..." # Stupid race condition gymnastics... # Make a temp file then move it to the target file to avoid symlinks CNTFILE=`mktemp /tmp/kishopper.XXXXXX` mv $CNTFILE /tmp/kismet_hopper.control WAITTIME=0 while test "$WAITTIME" -le 5; do if test ! -f /var/run/kismet_hopper.pid; then break fi sleep 1 WAITTIME=$(($WAITTIME+1)) done if test "$WAITTIME" -gt 5; then echo "kismet_hopper pid $HOPPERPID didn't seem to die cleanly as requested " echo "within 5 seconds. You'll have to find it and kill it yourself if its" echo "still running." fi rm /tmp/kismet_hopper.control fi echo "Done. Run kismet_unmonitor or eject and re-insert your card (or restart your" echo " pcmcia services) to return your card to normal operation."