diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index 6262a8fa..81a4e9a0 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -263,7 +263,7 @@ while(1) { if($line =~ /\s+Cell \d+ - Address: (\S+)/) { - pushAP($signal, $chan, $key, $ssid, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) } $mac = $1; $mode = ""; } @@ -273,10 +273,11 @@ while(1) if($line =~ /\bChannel:(\d+)/) { $chan = $1 } if($line =~ /\bSignal level=([\d-]+)/) { $signal = $1 } if($line =~ /\bEncryption key:(\w+)/) { $key = $1 } + if($line =~ /\bExtra: Last beacon: (\d+)ms/) { $lastseen = $1 } } close(FILE); - pushAP($signal, $chan, $key, $ssid, $mac, $mode); + if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) } sleep 1 if not scalar @list and $loops != 1; if(not $batch) diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 94e9a98e..1e449155 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -553,10 +553,10 @@ sub get_wifi_signal chomp $ssid; my ($SignalLevel) = "N/A"; my ($NoiseFloor) = "N/A"; - foreach(`iwlist $_[0] scanning essid "$ssid" |grep -A 5 -B 5 "$ssid"`) - { - next unless /Signal level=([\d\-]+) dBm/; - $SignalLevel=$1; + foreach(`iwlist $_[0] scanning essid "$ssid" |tr '\n' ' '|sed 's/Cell \\([0-9]\\{2,\\}\\) - Address:/\\nCell \\1 - Address:/g'|grep -i "$ssid"`) + { + next unless /.*Signal level=([\d\-]+) dBm.* Extra: Last beacon: ([\d]+)ms/; + if ( $2 < 10000 ) {$SignalLevel=$1;} } foreach(`iw dev $_[0] survey dump|grep -A 1 \"\\[in use\\]\"`)