Wireless scanner for linux

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Author Message
kuthulu
DD-WRT User


Joined: 20 Feb 2007
Posts: 219
Location: Santiago, Chile

PostPosted: Mon Jul 14, 2008 16:52    Post subject: Wireless scanner for linux Reply with quote
it's a gui wifi scanner for linux, it looks like netstumbler.
it's very simple, written in python and gtk.

download it from here:
http://kuthulu.com/iwscanner/index.php?module=download

_________________
Linksys WRT54G v6 - DD-WRT Micro v24 with AutoAP as a Repeater.
wifi scanner for linux
http://kuthulu.com/iwscanner
ssh/telnet connection manager for linux
http://kuthulu.com/gcm
Sponsor
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1858
Location: Hung Hom, Hong Kong

PostPosted: Wed Feb 28, 2024 13:15    Post subject: Reply with quote
Related:

DD-WRT :: View topic - Wireless Network Scanner script (Kuthulu) Help please ?
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=43598&start=5

Useful Scripts - DD-WRT Wiki
https://wiki.dd-wrt.com/wiki/index.php/Useful_Scripts#Wireless_Network_Scanner_.28working_on_DD-WRT_v24.29

DD-WRT :: View topic - Command for AUTO REFRESH for Site Survey
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=45184

DD-WRT :: View topic - where is site survey function?
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=334867

DD-WRT :: View topic - SSID miss w/ 5GHz in Site Survey
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=499337

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw


Last edited by mwchang on Tue Mar 19, 2024 11:16; edited 4 times in total
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1858
Location: Hung Hom, Hong Kong

PostPosted: Wed Feb 28, 2024 13:18    Post subject: Reply with quote
Download the attached scanner.sh.txt, rename it to scanner.sh to use it.

If you cut-and-paste these codes into an SSH session via Windows Notepad, you might need to remove trailing carriage return ("\013") at the end of each line using command dos2unix, or Awk (not Ash shell) will complain about unexpected tokens!

DOS to Unix: Commands and Examples {6 Methods Explained}
https://phoenixnap.com/kb/convert-dos-to-unix
Quote:
Files created in DOS/Windows use carriage return (\r) and line feed (\n) for line endings. However, files in Unix/Linux solely use line feed.

Code:
#!/bin/sh
#
# Created by: kuthulu
#
# DD-WRT :: View topic - Wireless scanner for linux
# https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=34924&highlight=scanner
#
# DD-WRT :: View topic - Wireless Network Scanner script (Kuthulu) Help please ?
# https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=43598
#
# DD-WRT :: View topic - site survey vs. NetStumbler
# https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=23663&highlight=scanner
# wl passive 1
# to go back to normal mode type:
# wl passive 0
# when setting passive to 1 you are putting the router into passive scan mode,
# by default the router is in active scan mode.
# In active mode the router detects other APs by sending a packet and waiting
# for response. Only the Aps that send a response are showed in the site survey page.
# In passive mode the router just listens for packets from every AP.
#
# http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Wireless_Network_Scanner_.28working_on_DD-WRT_v24.29
#####################################
#
# Jul 15, 2008 Created by kuthulu at forum.dd-wrt.com (https://kuthulu.com/)
#              https://forum.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=14849
# Dec 06, 2008 Reposted and edited by ruddles at forum.dd-wrt.com
#              https://forum.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=49001
# Feb 28, 2024 Modified by mwchang(toylet.toylet@gmail.com) to fix bugs
#
#####################################
#
# The various escape codes you can use to color output to StdOut from Node JS · GitHub
# https://gist.github.com/abritinthebay/d80eb99b2726c83feb0d97eab95206c4
#
# talyian.github.io/ansicolors/
# https://talyian.github.io/ansicolors/
#
# Service set (802.11 network) - Wikipedia
# https://en.wikipedia.org/wiki/Service_set_(802.11_network)
# https://en.wikipedia.org/wiki/Service_set_(802.11_network)
#
# SSID Naming Conventions
# https://www.cisco.com/assets/sol/sb/WAP321_Emulators/WAP321_Emulator_v1.0.0.3/help/Wireless05.html
#
# The SSID (Service Set Identifier) can be any alphanumeric, case-sensitive entry from 2 to 32 characters.
# The printable characters plus the space (ASCII 0x20) are allowed, but
# these six characters are not: ?, ", $, [, \, ], and +.
#
# Because the site_survey command of DD-WRT uses "[" and "]" as field separators,
# the following SSID names will break this program when using them as Awk field separators:
#
# 1. "[LG_StickVacuum]xxxx"
# [code][ 2] SSID[[LG_StickVacuum]e6cb] BSSID[82:5B:65:68:E6:CB][....[/code]
#
awk -F "[][]" '

function haha() {
# dump input from site_survey
while (command|getline xx)
{
  print xx;
}
}

BEGIN{
IGNORECASE = 1;
command = "site_survey 2>&1";


# ANSI terminal control codes
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";
underscore = "\x1b[4m"; clear = "\e[2J";
home = "\x1b[0;0H"; erase2end = "\x1b[K";

home = "\x1b[H";

dim = "\x1b[2m";
underscore = "\x1b[4m";
blink = "\x1b[5m";
reverse = "\x1b[7m";
hidden = "\x1b[8m";
reset = "\x1b[0m";
bright = "\x1b[1m";

cName = white; cSignal = green;
cNoise = red; cCaps = green;
cStrengthLow = blue blueback; cChannel = green;
cStrengthMed = white whiteback;
cStrengthHi = green greenback;
cStrengthAged = red;

# for testing no input
# command="";

zz=0;

for(;;)
{
while (command|getline)
{
# skip line 1
if ($22 == "") continue;

# using BSSID as array index
bssid=$6;

#name[bssid] = $4;
name[bssid]="[]";
# if ($4!="") {
if ($4=="") {
  # SSID contains square brackets, breaking this parsing
  zz=1;
} else {
  # trim all spaces in AP name
  cmd="echo " $4 " | sed -e s/[[:blank:]]//g";
  cmd | getline result;
  close(cmd);
  name[bssid]=result;
}

channel[bssid] = $8;
freq[bssid]=$10;
rssi[bssid] = $14;
noise[bssid]= $16;
caps[bssid] = $20;
rate[bssid]=$24;
# convert stringt to number
row[bssid]=$2+0;

# arbitrary strength calc through trial and error... modify as you wish:
# be careful of the space before "+90"
sigstrength = ((rssi[x] - noise[x])*1.5) + ((rssi[x] +90)*1.5);
if (sigstrength <1) sigstrength=0;
strg[bssid]=sigstrength;

}
close(command);

# gsub(/[^\11\12\15\40-\176]/,"");
# asort(name);

#fmt = "%s%-15s %s%0"sigstrength"d "reset erase2end "\n %s %s%-4d %s%-4d %s%-4d %s%2s " reset erase2end "\n" erase2end "\n";
fmt="%-4s %-30s %4s %4s %4s %4s %4s %5s %-18s %8s\n";

printf "%s%s%s",home,clear;
printf "%s%s%s",bright,white,underscore;
printf fmt, "Row","Name","Chnl","Freq","RSSI","Rate","Caps","Noise","BSSID","Strength";
printf "%s%s",reset,white;
ln=0;
for (x in name)
{
# printf fmt, cName,name[x],cStrength,0,x,cSignal,rssi[x],cNoise,noise[x],cChannel, channel[x],cCaps,caps[x];
# print row[x] " " name[x] "      " channel[x] "  " rssi[x] "    " noise[x] " " x;
printf fmt, row[x],name[x],channel[x],freq[x],rssi[x],rate[x],caps[x],noise[x],x,strg[x];
ln++;
#
# colorize strength
# cStrength = cStrengthLow;
# if(sigstrength>4) cStrength = cStrengthMed;
# if(sigstrength>7) cStrength = cStrengthHi;
# if(age[x]=0) cStrength = cStrengthAged;
}
if (ln == 0) {
    print bright yellow "No Results - Do you have survey capability?"
  }
printf "%s%s",bright,white;
print "Rows: " ln yellow "                          Hit [Ctrl]+[C] to stop!";

# debugging disabled
zz=0;
if (zz==1) {
   haha();
   exit;
}

}
}
'

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1858
Location: Hung Hom, Hong Kong

PostPosted: Mon Mar 04, 2024 12:15    Post subject: Reply with quote
Attached is the scanner script as of 04 Mar 2024! Need to login to see attachments.

This script is NOT to be executed in Admin->Command Prompt of the WEBUI, but in a SSH/Telnet shell!!

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1858
Location: Hung Hom, Hong Kong

PostPosted: Tue Mar 19, 2024 10:52    Post subject: Reply with quote
Attached is the scanner script as of 19 Mar 2024! Need to login to see attachments.

Instead of converting square braces in the ouput of the site_survey command to curly ones, it's better to convert them to the non-printable tab character!

This script is NOT to be executed in Admin->Command Prompt of the WEBUI, but in a SSH/Telnet shell!!

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum