Scanejar clients desde shell de forma visual

Feia temps que ho buscava i al final l'he trobat. Una aplicació que fa "survey" i el mostra per shell.

URL on l'he trobat http://www.seattlewireless.net/index.cgi/LinksysWrt54g
Una imatge val més que mil paraules http://www.toozy.com/scanner.gif

La instalació és molt simple, entrem al router per telnet o ssh anem al directori /tmp i creem l'script.
Per executar-lo: awk -f scanner

Tuto pas a pas (el text entre cometes son comandes que posarem igual):
- Entrem al router
- "cd /tmp"
- "cat - >scanner"
- enganxem el text de sota (com si fos el unsolclick) i farem control-c per finalitzar
- per executar-lo "awk -f scanner"

L'script el podem "guardar" permanentment si tenim una SD al router o si ho guardem en una unitat compartida.

------------------ Selecciona i enganxa el text de sota -----------------------
# cat - >scanner
# Show scanresults in consistent order with graphical bars.
# To be run via telnet to WRT54g running modified firmware.
# Do the following. Use your own router address instead of 192.168.1.1 on the following lines
# Login via telnet:
# telnet 192.168.1.1
# a simple test to make sure you can run this script, type:
# wl scan; wl scanresults
# and make sure you can run those commands. If not this program will not work.
# If you succeeded with the scanresults then
# copy and paste this entire text into the terminal window
# (the cat - >scanner line will copy the rest of the file into a file named 'scanner')
# and then hit return and then ctrl-c to close the file.
# then just run script by typing the following line:
# awk -f scanner
#
# I hereby release this into the public domain. Justin Jones, 2005,2006
#

BEGIN{
IGNORECASE = 1;
command = "wl scan 2> /dev/null ; wl scanresults 2> /dev/null";
red = "\x1b[31m"; green = "\x1b[32m";
greenback="\x1b[42m"; yellow = "\x1b[33m";
cyan = "\x1b[36m"; blue = "\x1b[34m";
blueback = "\x1b[44m"; white = "\x1b[37m";
whiteback = "\x1b[47m"; reset = "\x1b[0m";
underscore = "\x1b[4m"; clear = "\x1b[2J";
home = "\x1b[0;0H"; erase2end = "\x1b[K";
cName = white; cSignal = green;
cNoise = red; cCaps = green;
cStrengthLow = blue blueback; cChannel = green;
cStrengthMed = white whiteback;
cStrengthHi = green greenback;
cStrengthAged = red;

print clear;
for(;;)
{
while (command|getline)
{
if(/^SSID/) { name = $2; rssi = $6;noise= $9}
if(/^Mode/) {rssi = $4;noise= $7; channel = $10 }
if(/^BSSID/) {bssid = $2; caps = $4" "$5" "$6" "$7" "$8" "$9" "$10 }
if(/^Supported/)
{
name[$bssid] = name
rssi[$bssid] = rssi
noise[$bssid]= noise
channel[$bssid] = channel
caps[$bssid] = caps
}
}
close(command)
printf home;
ln = 0;
print white " Name Signal Noise Channel Type";
for (x in name)
{
{
#arbitrary strength calc through trial and error... modify as you wish:
sigstrength = ((rssi[x] - noise[x])*1.5) + ((rssi[x] +90)*1.5);
if (sigstrength <1) sigstrength=0;
cStrength = cStrengthLow;
if(sigstrength>4) cStrength = cStrengthMed;
if(sigstrength>7) cStrength = cStrengthHi;
if(age[x]=0) cStrength = cStrengthAged;

fmt = "%s%-15s %s%0"sigstrength"d "reset erase2end "\n %s%-4d %s%-4d %s%-4d %s%2s %s%10s " reset erase2end "\n" erase2end "\n";
printf fmt, cName,name[x],cStrength,0,cSignal,rssi[x],cNoise,noise[x],cChannel, channel[x],cCaps,caps[x];
rssi[x] = "-1000 xxxx";
ln++;
}
}
if (ln ==0) print red "No Results - Do you have wl scan capability? \nThis program depends on 'wl scan; wl scanresults' to run. Hit ctrl-c to stop."
print erase2end;
}
}

--------------------------- Fins aquí ---------------------------------

pàgina generada en: 0.428 segons.