File : parse-iwlist.awk
BEGIN { OFS = "\t"; } # OFS is a field separator used for "print"/\<Cell/ {# New cell description has started, so we need to print a previous one.# Detect security mode first.if (wpa) { security = "wpa" } else { if (wep) { security = "wep" } else { security = "none" }}if (essid) print essid, security, quality;# Reset security flags.wep = 0; wpa = 0;}/\<ESSID:/ {essid = substr($0, index($0, ":") + 1);essid = substr(essid, 2, length(essid) - 2) # discard quotes}/\<Quality/ {# We should support several output formats from iwlist scan (from# wireless_tools package):## 1) Quality:30/70# 2) Quality=20/100# 3) Quality:60## Quality might be separated with '=' or with ':' and we might have maximal# value present or not. This depends on the driver used.#split($1, q, "[:=]"); # after split: q[1] -> "Quality", q[2] -> quality valuesplit(q[2], qvalues, "/");if (qvalues[2]) {quality = int(qvalues[1] / qvalues[2] * 100); # we have both parts, divide} else {quality = qvalues[1]; # we have only one part, use it as-is}}/\<Encryption key:(o|O)n/ { wep = 1 }/\<IE:.*WPA.*/ { wpa = 1 }END {# handle last cellif (wpa) { security = "wpa" } else { if (wep) { security = "wep" } else { security = "none" }}if (essid) print essid, security, quality;}Command :# iwlist wlan0 scan | awk -f parse-iwlist.awkiptime_2 wpa 100 lab2 wep 100 PRODEA none 100 HMC_HW wep 98 kotech wpa 41 portthru none 44 orbotech wpa 58 beseto-1 wpa 58 PCMM_HMK wpa 50 Air_net_ct wpa 47 KT_WLAN wep 47 000D0B836EA6 wep 35 NHTECH_ceo wpa 41 netis wpa 47 3Team wpa 47 golf19 wpa 58 EE_2F wpa 52 FREE2USE none 41 HNB200_2G none 55 myLGNet wep 38 zero none 47 chemkosc wep 50 KT_WLAN_5D5A wpa 52 iptime none 41Link :
[BCM7231] WIFI usage (with wireless_toos and wpa-supplicant) (0) | 2013.11.05 |
---|---|
[Error] route/cls/ematch_syntax.y:31.9-16: syntax error, unexpected identifier, expecting string (0) | 2013.11.05 |