Feb 8
Linux

so, iwlist throws its output in different order depending of the wifi nic, so we need to scan and parse, to see 3 columns: 


signal strength: encryption needed: ESSID
27:on:CASA
27:on:AP1133
30:on:CC5763
32:on:XX1330
36:off:gg54g


So, we wrote a script called "scan" that loops to all wlan interfaces and scans for APs.


#!/bin/bash

ifconfig -a  |grep -i wlan | awk '{ print $1 }'|while read i;do
        echo "#---- scanning on $i"
(       ifconfig $i up
        iwlist $i scan | egrep -i 'essid|freq|qual|encr' |nawk 'ORS=NR%4?" ":"\n"'| tr -s ' '| while read l;do
                AP=`echo "$l "|awk '{s=substr($0,index($0,"ESSID:")+7);print substr(s,1,index(s,"\"")-1)}'`
                EN=`echo "$l "|awk '{s=substr($0,index($0,"Encryption key:")+15);print substr(s,1,index(s," ")-1)}'`
                QU=`echo "$l "|awk '{s=substr($0,index($0,"Quality=")+8);print substr(s,1,index(s,"/")-1)}'`
                echo "$QU:$EN:$AP"
        done
) | sort -n
done


Posted by rdircio

| Top Exits (0)
Vote for articles fresher than 7 days!
Current karma: none, 0 vote(s) 266 hits

View as PDF: This entry | This month | Full blog

0 Trackbacks

  1. No Trackbacks

0 Comments

Display comments as(Linear | Threaded)
  1. No comments

Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA