Created
June 27, 2019 02:11
-
-
Save erm3nda/6ea9957125d5ed9a96ee24281ae41ed8 to your computer and use it in GitHub Desktop.
WPS automation
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
#!/bin/bash | |
# automate WPS Push Button using wpa_supplicant | |
# see also: https://w1.fi/cgit/hostap/plain/wpa_supplicant/README-WPS | |
# make this script run at boot-time | |
INHIBIT="/etc/wpa_supplicant/wps_inhibit" | |
if [ -e $INHIBIT ]; then | |
exit 0 | |
fi | |
while /bin/true; do | |
state="$( wpa_cli status | sed -n 's/wpa_state=\(.*\)/\1/p')" | |
if [ "$state" = "COMPLETED" ]; then | |
touch $INHIBIT | |
exit 0 | |
fi | |
wpa_cli wps_pbc | |
# wps_pbc returns immediately but will start an action that lasts 2 minutes | |
sleep 120 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment