iw-scan.sh 701 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. ## SuperGlue project | http://superglue.it | 2014 | GPLv3
  3. ## http://git.superglue.it/superglue/serverfiles
  4. ##
  5. ## iw-scan.sh - scan for wireless networks
  6. iwScan() {
  7. set -o noglob
  8. local AP
  9. local S
  10. while read -r AP; do
  11. [[ "${AP//'SSID: '*}" == '' ]] && printf '%b' "${AP/'SSID: '}\n"
  12. [[ "${AP//'signal: '*}" == '' ]] && ( S=( ${AP/'signal: '} ); printf '%b' "${S[0]},";)
  13. [[ "${AP//'last seen: '*}" == '' ]] && ( S=( ${AP/'last seen: '} ); printf '%b' "${S[0]},";)
  14. done <<< "$(runSuid iw wlan0 scan)"
  15. set +o noglob
  16. }
  17. iwScanJ() {
  18. set -o noglob
  19. local S=$(runSuid "ubus -S call iwinfo scan '{\"device\":\"wlan0\"}'")
  20. printf '%b' "$S"
  21. set +o noglob
  22. }
  23. #iwScanJ