-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ffbsee/feature_wifiscan
new script: wifiscan
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=ffbsee-wifiscan | ||
PKG_VERSION:=0.1 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_MAINTAINER:=Wolf <[email protected]> | ||
PKG_LICENSE:=MIT | ||
|
||
include $(TOPDIR)/../package/gluon.mk | ||
|
||
define Package/ffbsee-wifiscan | ||
TITLE:=The wifiscan-scripts generate a wifiscan-result-json-string | ||
DEPENDS:=+iw | ||
endef | ||
|
||
$(eval $(call BuildPackageGluon,ffbsee-wifiscan)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
function wifilist() | ||
{ | ||
iw dev | grep "Interface" | grep -v "mesh" | sed 's/.*Interface\|//' | while read device | ||
do | ||
iw dev $device scan lowpri | awk -f wlan_scan.awk | ||
done | ||
} | ||
result="["$(wifilist|sed '$s/,$//')"]" | ||
echo $result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/^BSS/ { | ||
mac = gensub ( /^BSS[[:space:]]*([0-9a-fA-F:]+).*?$/, "\\1", "g", $0 ); | ||
} | ||
/^[[:space:]]*signal:/ { | ||
signal = gensub ( /^[[:space:]]*signal:[[:space:]]*(\-?[0-9.]+).*?$/, "\\1", "g", $0 ); | ||
} | ||
/^[[:space:]]*\* primary channel:/ { | ||
channel = gensub (/^[[:space:]]*\* primary channel:[[:space:]]*(\-?[0-9.]+).*?$/, "\\1", "g", $0); | ||
} | ||
/^[[:space:]]*SSID:/ { | ||
ssid = gensub ( /^[[:space:]]*SSID:[[:space:]]*([^\n]*).*?$/, "\\1", "g", $0 ); | ||
printf ( "{\"ssid\": \"%s\", \"mac\": \"%s\", \"signal\": %s, \"channel\": \"%s\"},\n", ssid, mac, signal, channel); | ||
} |