]>
git.ipfire.org Git - thirdparty/hostap.git/blob - wpaspy/test.py
3 # Test script for wpaspy
4 # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
6 # This software may be distributed under the terms of the BSD license.
7 # See README for more details.
13 wpas_ctrl
= '/var/run/wpa_supplicant'
17 if os
.path
.isdir(wpas_ctrl
):
19 ifaces
= [os
.path
.join(wpas_ctrl
, i
) for i
in os
.listdir(wpas_ctrl
)]
20 except OSError, error
:
21 print "Could not find wpa_supplicant: ", error
25 print "No wpa_supplicant control interface found"
30 wpas
= wpaspy
.Ctrl(ctrl
)
38 print "Testing wpa_supplicant control interface connection"
42 print "Connected to wpa_supplicant"
43 print wpas
.request('PING')
47 print "Could not open event monitor connection"
52 print wpas
.request('SCAN')
61 if 'CTRL-EVENT-SCAN-RESULTS' in ev
:
62 print 'Scan completed'
63 print wpas
.request('SCAN_RESULTS')
68 if __name__
== "__main__":