Advertisement
s243a

runPrismScan() - /usr/sbin/wag-profiles.sh - puppylinux

Oct 16th, 2016
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.25 KB | None | 0 0
  1. # lines 1992 to 2021 of /usr/sbin/wag-profiles.sh
  2. # http://www.pearltrees.com/s243a/runprismscan-puppylinux/id16476573
  3. # Dougal: put this into a function, so we can use it at boot time
  4. # (note that it echoes Xs for the progress bar)
  5. runPrismScan()
  6. {
  7.     INTERFACE="$1"
  8.     # enable interface
  9.     wlanctl-ng "$INTERFACE" lnxreq_ifstate ifstate=enable >/tmp/wlan-up 2>&1
  10.     # scan (first X echoed only afterwards!
  11.     wlanctl-ng "$INTERFACE" dot11req_scan bsstype=any \
  12.      bssid=ff:ff:ff:ff:ff:ff ssid="" scantype=both \
  13.       channellist="00:01:02:03:04:05:06:07:08:09:0a:0b:00:00" \
  14.        minchanneltime=200 maxchanneltime=250 >/tmp/prism-scan-all 2>/dev/null
  15.     echo "X"
  16.     # get number of access points (make sure we get integer)
  17.     POINTNUM=$(grep -F 'numbss=' /tmp/prism-scan-all 2>/dev/null | cut -d= -f2 | grep [0-9])
  18.     rm /tmp/prism-scan-all >/dev/null 2>&1
  19.     ## Dougal: not sure about this -- need a way to make sure we get something
  20.     #if grep -F 'resultcode=success' /tmp/prism-scan-all ; then
  21.     if [ "$POINTNUM" ] ; then
  22.       # get scan results for all access points
  23.       for P in $(seq 0 $POINTNUM)
  24.       do
  25.         wlanctl-ng "$INTERFACE" dot11req_scan_results bssindex=$P >/tmp/prism-scan$P 2>/dev/null
  26.       done
  27.       echo "X"
  28.     else # let us know it failed
  29.       return 1
  30.     fi
  31.     return 0
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement