blob: e79228ddc14f4a4980f36eba3ed373cba85dded0 (
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
|
#!/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 interface.state()
print interface.scan()
print "[ %s ]" % (path)
capabilities = interface.capabilities()
for key in capabilities.keys():
list = ""
for value in capabilities[key]:
list += " " + value
print " %s =%s" % (key, list)
time.sleep(2)
print 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])
|