diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index b9b1c027..85ddac3f 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -221,6 +221,7 @@ while(1) $mode = "Connected Ad-Hoc Station"; $signal = 0; $key = ""; + $lastseen = 0; ++$iters; open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed"; @@ -229,7 +230,9 @@ while(1) { if($line =~ /Station (\S+) \(on $iface\)/) { - pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) } + + $lastseen = 0; $mac = $1; $ip = `grep $mac /proc/net/arp | egrep "^10.*\$" | tail -1`; $mac = uc $mac; @@ -247,11 +250,13 @@ while(1) else { $host = "????" } } - if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + if($line =~ /inactive time:\t(\d+) ms/) { $lastseen = $1 } } close(FILE); - pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $mychan, $key, $myssid, $host, $mac, $mode) } + sleep 1 if not scalar @list and $loops != 1; if(not $batch)