From 0ab44e47314d6fd42d39957b2d0d28da9a3c4dd9 Mon Sep 17 00:00:00 2001 From: AE6XE Date: Wed, 1 Apr 2015 21:49:07 -0700 Subject: [PATCH] wscan update to show neighbor mesh node signals --- files/usr/local/bin/wscan | 57 +++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/files/usr/local/bin/wscan b/files/usr/local/bin/wscan index a58357db..d228123c 100755 --- a/files/usr/local/bin/wscan +++ b/files/usr/local/bin/wscan @@ -1,12 +1,13 @@ #!/usr/bin/perl -w =for commnet - Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks Copyright (C) 2015 Conrad Lara See Contributors file for additional contributors Copyright (c) 2013 David Rivenburg et al. BroadBand-HamNet + 2015-04-01 AE6XE update to display neighbor nodes + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 3 of the License. @@ -285,15 +286,20 @@ die "bad interface" if not defined $iface; if($raw) { system("/usr/bin/iwinfo $iface scan"); + system("/usr/sbin/iw $iface station dump"); exit; } +$bbchan = 1; + while(1) { open(FILE, "/usr/bin/iwinfo $iface scan 2>&1 |") or die "iwinfo failed"; $mode = ""; + $ssid = ""; + $signal = 0; + $chan = 99; @list = (); - ++$iters; while($line = ) { @@ -301,7 +307,7 @@ while(1) { pushAP($signal, $chan, $key, $ssid, $mac, $mode); $mac = $1; - $mode = ""; + if($ssid =~ /Broadband/) { $bbchan = $chan } } if($line =~ /\bESSID: "(.*)"/) { $ssid = $1 } @@ -313,26 +319,61 @@ while(1) } close(FILE); + + if($ssid =~ /Broadband/) { $bbchan = $chan } pushAP($signal, $chan, $key, $ssid, $mac, $mode); sleep 1 if not scalar @list and $loops != 1; - + + $mode = ""; + $signal = 0; + $key = "none"; + $chan = 1; + ++$iters; + + open(FILE, "/usr/sbin/iw $iface station dump 2>&1 |") or die "/usr/sbin/iw failed"; + + while($line = ) + { + if($line =~ /Station (\S+) \(on $iface\)/) + { + pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + $mac = $1; + $ip = `grep $mac /proc/net/arp`; + $ip =~ s/[ \t].*$// ; + chomp($ip); + $ssid = $ip; + $mac = uc $mac; + if( $ip ne "") + { + foreach(`nslookup $ip`){ next unless ($ssid) = /Address 1: $ip (\S+)\.local\.mesh/ } + } + $mode = 'Ad-Hoc'; + } + + if($line =~ /signal avg:[ \t]+([-\d]+)/) { $signal = $1 } + } + + close(FILE); + pushAP($signal, $bbchan, $key, $ssid, $mac, $mode); + sleep 1 if not scalar @list and $loops != 1; + if(not $batch) { if($avg) { system "clear"; - printf "Sig Rel Ch E SSID MAC Vendor %6d\n", $iters; + printf "Sig Rel Ch E SSID or Hostname MAC Vendor %6d\n", $iters; print "--- --- -- - -------------------------------- ------------- ------\n"; } elsif($web) { print "\n"; - print "\n"; + print "\n"; } else { - system "clear"; - printf "Sig Ch E SSID MAC Vendor %6d\n", $iters; + #system "clear"; + printf "Sig Ch E SSID or Hostname MAC Vendor %6d\n", $iters; print "--- -- - -------------------------------- ------------- ------\n"; } }
SigChanEncSSIDMACVendor
SigChanEncSSID or HostnameMACVendor