blob: 68ac66300268abf59b40f0f4be2a0baf18da4c1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/usr/bin/python
import dbus
import time
WPA_NAME='fi.epitest.hostap.WPASupplicant'
WPA_INTF='fi.epitest.hostap.WPASupplicant'
WPA_PATH='/fi/epitest/hostap/WPASupplicant'
bus = dbus.SystemBus()
dummy = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH),
'org.freedesktop.DBus.Introspectable')
#print dummy.Introspect()
manager = dbus.Interface(bus.get_object(WPA_NAME, WPA_PATH), WPA_INTF)
try:
path = manager.getInterface("wlan0")
except:
path = manager.addInterface("wlan0")
interface = dbus.Interface(bus.get_object(WPA_NAME, path),
WPA_INTF + ".Interface")
print "state = %s" % (interface.state())
try:
print "scanning = %s" % (interface.scanning())
except:
pass
print "[ %s ]" % (path)
capabilities = interface.capabilities()
for key in capabilities.keys():
list = ""
for value in capabilities[key]:
list += " " + value
print " %s =%s" % (key, list)
interface.scan()
time.sleep(1)
try:
print "scanning = %s" % (interface.scanning())
except:
pass
time.sleep(1)
print "state = %s" % (interface.state())
results = interface.scanResults()
print results
path = results[0]
print "[ %s ]" % (path)
bssid = dbus.Interface(bus.get_object(WPA_NAME, path),
WPA_INTF + ".BSSID")
properties = bssid.properties()
for key in properties.keys():
print " %s = %s" % (key, properties[key])
|