#!/bin/bash test "$USER" != 'root' && { echo 'Starte bitte das Script als root.' ; exit ; } echo '^ Datum ^ MAC ^ Ch. ^ Qual. ^ Pw ^ Cr ^ SSID ^' >> wlan-time-note.dat datum=`date +%s` iwlist wlan0 scan \ | grep -B5 'ESSID' \ | paste -s -d' ' \ | sed 's/--/\n/g; s/key:on/key:1/g;s/key:off/key:0/g' \ | sed 's/^.*\(Cell\).*Address: \([^ ]*\).*Channel:\([0-9][0-9]*\).*Quality=\([0-9][0-9]*\)\/.*level=-\([0-9][0-9]*\).*key:\([01]\).*ESSID:\("[^"]*"\).*$/| \1 | \2 | \3 | \4 | \5 | \6 | \7 |/' \ | sed "s/^| Cell |/| ${datum} |/" >> wlan-time-note.dat
#!/bin/bash echo 'Finde alle uniq-en MACs ...' grep '^|' wlan-time-note.dat | cut -f3 -d'|' | tr -d ' ' | sort | uniq > tmp-macs.tmp echo 'Plot ...' cat > tmp-plot.plt <<-EOF #set xdata #set xtics format "%d.%m %H:%M" splot 1/0 notitle, \\ EOF echo 'Select MAC ...' lfd=0; for mac in `cat tmp-macs.tmp` do grep '^|' wlan-time-note.dat | grep "| ${mac} |" | cut -f2,4,5,8 -d '|' | tr -d '|' > tmp-mac-$lfd.dat key=`head -n1 tmp-mac-$lfd.dat | cut -f2 -d'"'` echo " 'tmp-mac-$lfd.dat' u 1:2:3 title '${key}' w l, \\" >> tmp-plot.plt lfd=$(( $lfd + 1 )) done echo 'Post...' echo ' 1/0 notitle;' >> tmp-plot.plt echo 'pause -1' >> tmp-plot.plt echo 'Gnuplot ...' gnuplot tmp-plot.plt echo 'Aufräumen ...' rm tmp*
#!/bin/bash echo 'Finde alle WLANs ...' grep '^| ' wlan-time-note.dat | cut -f8 -d '|' | sort | uniq | sed 's/^ "//g;s/" $//g;' | nl echo 'Preplots ...' cat > tmp-plot.plt <<-EOF set xrange[*:*] unset key EOF echo 'Wer ist ...' for SSID in Benedicts_iPhone Gruni iPhone Victorias_iPhone do echo " ... $SSID ?" ssid=`echo "$SSID" | tr '_' ' '` grep "| \"${ssid}\" |" wlan-time-note.dat > tmp-wlan.dat for mac in `cut -f3 -d'|' tmp-wlan.dat | sort | uniq` do echo "set title '$SSID'" >> tmp-plot.plt echo "plot 'tmp-${mac}.dat' u 1:4 w p pt 6;" >> tmp-plot.plt echo "pause -1" >> tmp-plot.plt grep "| ${mac} |" tmp-wlan.dat | cut -f1-5,8 -d'|' | tr -d '|' > tmp-${mac}.dat done done gnuplot tmp-plot.plt rm tmp* #echo 'Finde alle MACs ...' #grep '^| ' wlan-time-note.dat | cut -f3 -d '|' | sort | uniq