aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/examples
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-04-01 18:28:57 (GMT)
committerJouni Malinen <j@w1.fi>2013-04-01 18:28:57 (GMT)
commit88c8bf311efa4eb64468bed9b41b3110ab9effff (patch)
tree93ea3b69c0d1d78e2d008bebda7ff6e10c786efc /wpa_supplicant/examples
parente205401c720e382b2d291d79e081a1eaff96b0be (diff)
downloadhostap-88c8bf311efa4eb64468bed9b41b3110ab9effff.zip
hostap-88c8bf311efa4eb64468bed9b41b3110ab9effff.tar.gz
hostap-88c8bf311efa4eb64468bed9b41b3110ab9effff.tar.bz2
WPS NFC: Allow configuration token to be built from network block
"WPS_NFC_CONFIG_TOKEN <WPS/NDEF> <network id>" can now be used to build an NFC configuration token from a locally configured network. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/examples')
-rwxr-xr-xwpa_supplicant/examples/wps-nfc.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/wpa_supplicant/examples/wps-nfc.py b/wpa_supplicant/examples/wps-nfc.py
index 86473cd..dbc143a 100755
--- a/wpa_supplicant/examples/wps-nfc.py
+++ b/wpa_supplicant/examples/wps-nfc.py
@@ -53,10 +53,12 @@ def wpas_tag_read(message):
print wpas.request("WPS_NFC_TAG_READ " + message.encode("hex"))
-def wpas_get_config_token():
+def wpas_get_config_token(id=None):
wpas = wpas_connect()
if (wpas == None):
return None
+ if id:
+ return wpas.request("WPS_NFC_CONFIG_TOKEN NDEF " + id).rstrip().decode("hex")
return wpas.request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip().decode("hex")
@@ -258,9 +260,9 @@ def wps_tag_read(tag):
time.sleep(0.1)
-def wps_write_config_tag(clf):
+def wps_write_config_tag(clf, id=None):
print "Write WPS config token"
- data = wpas_get_config_token()
+ data = wpas_get_config_token(id)
if (data == None):
print "Could not get WPS config token from wpa_supplicant"
return
@@ -364,6 +366,10 @@ def main():
wps_write_config_tag(clf)
raise SystemExit
+ if len(sys.argv) > 2 and sys.argv[1] == "write-config-id":
+ wps_write_config_tag(clf, sys.argv[2])
+ raise SystemExit
+
if len(sys.argv) > 2 and sys.argv[1] == "write-er-config":
wps_write_er_config_tag(clf, sys.argv[2])
raise SystemExit