scan (458B)
1 #!/bin/rc 2 3 if (!~ `{id -u} 0) { 4 printf 'Give me root, not this stupid %s user!\n' `{whoami} >[1=2] 5 exit 1 6 } 7 8 interfaces = `$nl{ip a | awk '/^[0-9]/ {gsub(/:/, ""); print $2}'} 9 wireless = () 10 networks = () 11 12 for (i in $interfaces) { 13 if (~ $i wl*) { 14 wireless = ($wireless $i) 15 } 16 } 17 18 for (i in $wireless) { 19 networks = ($networks `$nl{iwlist $i scan | 20 awk '$1 ~ /^ESSID:".+"/ { 21 sub(/[^"]*"/, ""); sub(/"$/, ""); print 22 }' | sort -u}) 23 } 24 25 echo $^networks