Enigma2-SystemPlugins: -move NetworkWizard and WirelessLan Plugins into Enigma2 git...
[enigma2.git] / lib / python / Plugins / SystemPlugins / WirelessLan / Wlan.py
1 from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
2 from Components.MultiContent import MultiContentEntryText
3 from Components.GUIComponent import GUIComponent
4 from Components.HTMLComponent import HTMLComponent
5 from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
6 from Components.Console import Console
7
8 from os import system
9 from string import maketrans, strip
10 import sys
11 import types
12 from re import compile as re_compile, search as re_search
13 from iwlibs import getNICnames, Wireless, Iwfreq
14
15 list = []
16 list.append("WEP")
17 list.append("WPA")
18 list.append("WPA2")
19 list.append("WPA/WPA2")
20
21 weplist = []
22 weplist.append("ASCII")
23 weplist.append("HEX")
24
25 config.plugins.wlan = ConfigSubsection()
26 config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
27 config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
28
29 config.plugins.wlan.encryption = ConfigSubsection()
30 config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
31 config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2"))
32 config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
33 config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
34
35 class Wlan:
36         def __init__(self, iface):
37                 a = ''; b = ''
38                 
39                 for i in range(0, 255):
40                     a = a + chr(i)
41                     if i < 32 or i > 127:
42                         b = b + ' '
43                     else:
44                         b = b + chr(i)
45                 
46                 self.iface = iface
47                 self.wlaniface = {}
48                 self.WlanConsole = Console()
49                 self.asciitrans = maketrans(a, b)
50
51         def stopWlanConsole(self):
52                 if self.WlanConsole is not None:
53                         print "killing self.WlanConsole"
54                         self.WlanConsole = None
55                         del self.WlanConsole
56                         
57         def getDataForInterface(self, callback = None):
58                 #get ip out of ip addr, as avahi sometimes overrides it in ifconfig.
59                 print "self.iface im getDataForInterface",self.iface
60                 if len(self.WlanConsole.appContainers) == 0:
61                         self.WlanConsole = Console()
62                         cmd = "iwconfig " + self.iface
63                         self.WlanConsole.ePopen(cmd, self.iwconfigFinished, callback)
64
65         def iwconfigFinished(self, result, retval, extra_args):
66                 print "self.iface im iwconfigFinished",self.iface
67                 callback = extra_args
68                 data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
69                 #print "result im iwconfigFinished",result
70                 
71                 for line in result.splitlines():
72                         #print "line",line
73                         line = line.strip()
74                         if "ESSID" in line:
75                                 if "off/any" in line:
76                                         ssid = _("No Connection")
77                                 else:
78                                         tmpssid=(line[line.index('ESSID')+7:len(line)-1])
79                                         if tmpssid == '':
80                                                 ssid = _("Hidden networkname")
81                                         elif tmpssid ==' ':
82                                                 ssid = _("Hidden networkname")
83                                         else:
84                                             ssid = tmpssid
85                                 #print "SSID->",ssid
86                                 if ssid is not None:
87                                         data['essid'] = ssid
88                         if 'Frequency' in line:
89                                 frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
90                                 #print "Frequency",frequency   
91                                 if frequency is not None:
92                                         data['frequency'] = frequency
93                         if "Access Point" in line:
94                                 ap=line[line.index('Access Point')+14:len(line)-1]
95                                 #print "AP",ap
96                                 if ap is not None:
97                                         data['acesspoint'] = ap
98                         if "Bit Rate" in line:
99                                 br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
100                                 #print "Bitrate",br
101                                 if br is not None:
102                                         data['bitrate'] = br
103                         if 'Encryption key' in line:
104                                 if ":off" in line:
105                                     enc = _("Disabled")
106                                 else:
107                                     enc = line[line.index('Encryption key')+15 :line.index('   Security')]
108                                 #print "Encryption key",enc 
109                                 if enc is not None:
110                                         data['encryption'] = _("Enabled")
111                         if 'Quality' in line:
112                                 if "/100" in line:
113                                         qual = line[line.index('Quality')+8:line.index('/100')]
114                                 else:
115                                         qual = line[line.index('Quality')+8:line.index('Sig')]
116                                 #print "Quality",qual
117                                 if qual is not None:
118                                         data['quality'] = qual
119                         if 'Signal level' in line:
120                                 signal = line[line.index('Signal level')+14 :line.index(' dBm')]
121                                 #print "Signal level",signal            
122                                 if signal is not None:
123                                         data['signal'] = signal
124
125                 self.wlaniface[self.iface] = data
126                 
127                 if len(self.WlanConsole.appContainers) == 0:
128                         print "self.wlaniface after loading:", self.wlaniface
129                         self.WlanConsole = None
130                         if callback is not None:
131                                 callback(True,self.wlaniface)
132
133         def getAdapterAttribute(self, attribute):
134                 print "im getAdapterAttribute"
135                 if self.wlaniface.has_key(self.iface):
136                         print "self.wlaniface.has_key",self.iface
137                         if self.wlaniface[self.iface].has_key(attribute):
138                                 return self.wlaniface[self.iface][attribute]
139                 return None
140                 
141         def asciify(self, str):
142                 return str.translate(self.asciitrans)
143
144         
145         def getWirelessInterfaces(self):
146                 iwifaces = None
147                 try:
148                         iwifaces = getNICnames()
149                 except:
150                         print "[Wlan.py] No Wireless Networkcards could be found"
151                 
152                 return iwifaces
153
154         
155         def getNetworkList(self):
156                 system("ifconfig "+self.iface+" up")
157                 ifobj = Wireless(self.iface) # a Wireless NIC Object
158                 
159                 #Association mappings
160                 stats, quality, discard, missed_beacon = ifobj.getStatistics()
161                 snr = quality.signallevel - quality.noiselevel
162
163                 try:
164                         scanresults = ifobj.scan()
165                 except:
166                         scanresults = None
167                         print "[Wlan.py] No Wireless Networks could be found"
168                 
169                 if scanresults is not None:
170                         aps = {}
171                         for result in scanresults:
172                         
173                                 bssid = result.bssid
174                 
175                                 encryption = map(lambda x: hex(ord(x)), result.encode)
176                 
177                                 if encryption[-1] == "0x8":
178                                         encryption = True
179                                 else:
180                                         encryption = False
181                 
182                                 extra = []
183                                 for element in result.custom:
184                                         element = element.encode()
185                                         extra.append( strip(self.asciify(element)) )
186                                 
187                                 if result.quality.sl is 0 and len(extra) > 0:
188                                         begin = extra[0].find('SignalStrength=')+15
189                                                                         
190                                         done = False
191                                         end = begin+1
192                                         
193                                         while not done:
194                                                 if extra[0][begin:end].isdigit():
195                                                         end += 1
196                                                 else:
197                                                         done = True
198                                                         end -= 1
199                                         
200                                         signal = extra[0][begin:end]
201                                         #print "[Wlan.py] signal is:" + str(signal)
202
203                                 else:
204                                         signal = str(result.quality.sl)
205                                 
206                                 aps[bssid] = {
207                                         'active' : True,
208                                         'bssid': result.bssid,
209                                         'channel': result.frequency.getChannel(result.frequency.getFrequency()),
210                                         'encrypted': encryption,
211                                         'essid': strip(self.asciify(result.essid)),
212                                         'iface': self.iface,
213                                         'maxrate' : result.rate[-1],
214                                         'noise' : result.quality.getNoiselevel(),
215                                         'quality' : str(result.quality.quality),
216                                         'signal' : signal,
217                                         'custom' : extra,
218                                 }
219                                 print aps[bssid]
220                         return aps
221
222                 
223         def getStatus(self):
224                 ifobj = Wireless(self.iface)
225                 fq = Iwfreq()
226                 try:
227                         self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
228                 except:
229                         self.channel = 0
230                 #print ifobj.getStatistics()
231                 status = {
232                                   'BSSID': str(ifobj.getAPaddr()),
233                                   'ESSID': str(ifobj.getEssid()),
234                                   'quality': str(ifobj.getStatistics()[1].quality),
235                                   'signal': str(ifobj.getStatistics()[1].sl),
236                                   'bitrate': str(ifobj.getBitrate()),
237                                   'channel': str(self.channel),
238                                   #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
239                 }
240                 
241                 for (key, item) in status.items():
242                         if item is "None" or item is "":
243                                         status[key] = _("N/A")
244                                 
245                 return status
246
247
248
249 class WlanList(HTMLComponent, GUIComponent):
250         def __init__(self, session, iface):
251                 
252                 GUIComponent.__init__(self)
253                 self.w = Wlan(iface)
254                 self.iface = iface
255                 
256                 self.length = 0
257                 self.aplist = None
258                 self.list = None
259                 self.oldlist = None
260                 self.l = None
261                 self.l = eListboxPythonMultiContent()
262                 
263                 self.l.setFont(0, gFont("Regular", 32))
264                 self.l.setFont(1, gFont("Regular", 18))
265                 self.l.setFont(2, gFont("Regular", 16))
266                 self.l.setBuildFunc(self.buildWlanListEntry)            
267                                 
268                 self.reload()
269         
270         def buildWlanListEntry(self, essid, bssid, encrypted, iface, maxrate, signal):                                                                                                 
271                 
272                 res = [ (essid, encrypted, iface) ]
273                 
274                 if essid == "":
275                         essid = bssid
276                 
277                 e = encrypted and _("Yes") or _("No")
278                 res.append( MultiContentEntryText(pos=(0, 0), size=(470, 35), font=0, flags=RT_HALIGN_LEFT, text=essid) )
279                 res.append( MultiContentEntryText(pos=(425, 0), size=(60, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Signal: ")))
280                 res.append( MultiContentEntryText(pos=(480, 0), size=(70, 35), font=0, flags=RT_HALIGN_RIGHT, text="%s" %signal))
281                 res.append( MultiContentEntryText(pos=(0, 40), size=(180, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Max. Bitrate: %s") %maxrate ))
282                 res.append( MultiContentEntryText(pos=(190, 40), size=(180, 20), font=1, flags=RT_HALIGN_CENTER, text=_("Encrypted: %s") %e ))
283                 res.append( MultiContentEntryText(pos=(345, 40), size=(190, 20), font=1, flags=RT_HALIGN_RIGHT, text=_("Interface: %s") %iface ))
284                 return res
285                 
286                         
287         def reload(self):
288                 aps = self.w.getNetworkList()
289
290                 self.list = []
291                 self.aplist = []
292                 if aps is not None:
293                         print "[Wlan.py] got Accespoints!"
294                         for ap in aps:
295                                 a = aps[ap]
296                                 if a['active']:
297                                         if a['essid'] != '':
298                                         #       a['essid'] = a['bssid']
299                                                 self.list.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
300                                         #self.aplist.append( a['essid'])
301                 if self.oldlist is not None:
302                         for entry in self.oldlist:
303                                 if entry not in self.list:
304                                         self.list.append(entry)
305                 
306                 if len(self.list):
307                         for entry in self.list:
308                                 self.aplist.append( entry[0])
309                 self.length = len(self.list)
310                 self.oldlist = self.list
311                 self.l.setList([])
312                 self.l.setList(self.list)
313                         
314         GUI_WIDGET = eListbox
315
316
317         def getCurrent(self):
318                 return self.l.getCurrentSelection()
319         
320         
321         def postWidgetCreate(self, instance):
322                 instance.setContent(self.l)
323                 instance.setItemHeight(60)
324         
325         
326         def getLength(self):
327                 return self.length
328         
329         def getList(self):
330                 return self.aplist
331
332
333 class wpaSupplicant:
334         def __init__(self):
335                 pass
336         
337                 
338         def writeConfig(self):  
339                         
340                         essid = config.plugins.wlan.essid.value
341                         hiddenessid = config.plugins.wlan.hiddenessid.value
342                         encrypted = config.plugins.wlan.encryption.enabled.value
343                         encryption = config.plugins.wlan.encryption.type.value
344                         wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
345                         psk = config.plugins.wlan.encryption.psk.value
346                         fp = file('/etc/wpa_supplicant.conf', 'w')
347                         fp.write('#WPA Supplicant Configuration by enigma2\n')
348                         fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
349                         fp.write('eapol_version=1\n')
350                         fp.write('fast_reauth=1\n')     
351                         if essid == 'hidden...':
352                                 fp.write('ap_scan=2\n')
353                         else:
354                                 fp.write('ap_scan=1\n')
355                         fp.write('network={\n')
356                         if essid == 'hidden...':
357                                 fp.write('\tssid="'+hiddenessid+'"\n')
358                         else:
359                                 fp.write('\tssid="'+essid+'"\n')
360                         fp.write('\tscan_ssid=0\n')                     
361                         if encrypted:
362                                 if encryption == 'WPA' or encryption == 'WPA2' or encryption == 'WPA/WPA2' :
363                                         fp.write('\tkey_mgmt=WPA-PSK\n')
364                                         
365                                         if encryption == 'WPA':
366                                                 fp.write('\tproto=WPA\n')
367                                                 fp.write('\tpairwise=TKIP\n')
368                                                 fp.write('\tgroup=TKIP\n')
369                                         elif encryption == 'WPA2':
370                                                 fp.write('\tproto=WPA RSN\n')
371                                                 fp.write('\tpairwise=CCMP TKIP\n')
372                                                 fp.write('\tgroup=CCMP TKIP\n')                                         
373                                         else:
374                                                 fp.write('\tproto=WPA WPA2\n')
375                                                 fp.write('\tpairwise=CCMP\n')
376                                                 fp.write('\tgroup=TKIP\n')                                      
377                                         fp.write('\tpsk="'+psk+'"\n')
378                                                 
379                                 elif encryption == 'WEP':
380                                         fp.write('\tkey_mgmt=NONE\n')
381                                         if wepkeytype == 'ASCII':
382                                                 fp.write('\twep_key0="'+psk+'"\n')
383                                         else:
384                                                 fp.write('\twep_key0='+psk+'\n')
385                         else:
386                                 fp.write('\tkey_mgmt=NONE\n')                   
387                         fp.write('}')
388                         fp.write('\n')
389                         fp.close()
390                         system("cat /etc/wpa_supplicant.conf")
391                 
392         def loadConfig(self):
393                 try:
394                         #parse the wpasupplicant configfile
395                         fp = file('/etc/wpa_supplicant.conf', 'r')
396                         supplicant = fp.readlines()
397                         fp.close()
398                         ap_scan = False
399                         essid = None
400
401                         for s in supplicant:
402                                 split = s.strip().split('=',1)
403                                 if split[0] == 'ap_scan':
404                                         print "[Wlan.py] Got Hidden SSID Scan  Value "+split[1]
405                                         if split[1] == '2':
406                                                 ap_scan = True
407                                         else:
408                                                 ap_scan = False
409                                                 
410                                 elif split[0] == 'ssid':
411                                         print "[Wlan.py] Got SSID "+split[1][1:-1]
412                                         essid = split[1][1:-1]
413                                         
414                                 elif split[0] == 'proto':
415                                         print "split[1]",split[1]
416                                         config.plugins.wlan.encryption.enabled.value = True
417                                         if split[1] == "WPA" :
418                                                 mode = 'WPA'
419                                         if split[1] == "WPA WPA2" :
420                                                 mode = 'WPA/WPA2'
421                                         if split[1] == "WPA RSN" :
422                                                 mode = 'WPA2'
423                                         config.plugins.wlan.encryption.type.value = mode
424                                         print "[Wlan.py] Got Encryption: "+mode
425                                         
426                                 #currently unused !
427                                 #elif split[0] == 'key_mgmt':
428                                 #       print "split[1]",split[1]
429                                 #       if split[1] == "WPA-PSK" :
430                                 #               config.plugins.wlan.encryption.enabled.value = True
431                                 #               config.plugins.wlan.encryption.type.value = "WPA/WPA2"
432                                 #       print "[Wlan.py] Got Encryption: "+ config.plugins.wlan.encryption.type.value
433                                         
434                                 elif split[0] == 'wep_key0':
435                                         config.plugins.wlan.encryption.enabled.value = True
436                                         config.plugins.wlan.encryption.type.value = 'WEP'
437                                         if split[1].startswith('"') and split[1].endswith('"'):
438                                                 config.plugins.wlan.encryption.wepkeytype.value = 'ASCII'
439                                                 config.plugins.wlan.encryption.psk.value = split[1][1:-1]
440                                         else:
441                                                 config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
442                                                 config.plugins.wlan.encryption.psk.value = split[1]                                             
443                                         print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
444                                         print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
445                                         
446                                 elif split[0] == 'psk':
447                                         config.plugins.wlan.encryption.psk.value = split[1][1:-1]
448                                         print "[Wlan.py] Got PSK: "+split[1][1:-1]
449                                 else:
450                                         pass
451                                 
452                         if ap_scan is True:
453                                 config.plugins.wlan.hiddenessid.value = essid
454                                 config.plugins.wlan.essid.value = 'hidden...'
455                         else:
456                                 config.plugins.wlan.hiddenessid.value = essid
457                                 config.plugins.wlan.essid.value = essid
458                         wsconfig = {
459                                         'hiddenessid': config.plugins.wlan.hiddenessid.value,
460                                         'ssid': config.plugins.wlan.essid.value,
461                                         'encryption': config.plugins.wlan.encryption.enabled.value,
462                                         'encryption_type': config.plugins.wlan.encryption.type.value,
463                                         'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
464                                         'key': config.plugins.wlan.encryption.psk.value,
465                                 }
466                 
467                         for (key, item) in wsconfig.items():
468                                 if item is "None" or item is "":
469                                         if key == 'hiddenessid':
470                                                 wsconfig['hiddenessid'] = "home"
471                                         if key == 'ssid':
472                                                 wsconfig['ssid'] = "home"
473                                         if key == 'encryption':
474                                                 wsconfig['encryption'] = True                           
475                                         if key == 'encryption':
476                                                 wsconfig['encryption_type'] = "WPA/WPA2"
477                                         if key == 'encryption':
478                                                 wsconfig['encryption_wepkeytype'] = "ASCII"
479                                         if key == 'encryption':
480                                                 wsconfig['key'] = "mysecurewlan"
481
482                 except:
483                         print "[Wlan.py] Error parsing /etc/wpa_supplicant.conf"
484                         wsconfig = {
485                                         'hiddenessid': "home",
486                                         'ssid': "home",
487                                         'encryption': True,
488                                         'encryption_type': "WPA/WPA2",
489                                         'encryption_wepkeytype': "ASCII",
490                                         'key': "mysecurewlan",
491                                 }
492                 print "[Wlan.py] WS-CONFIG-->",wsconfig
493                 return wsconfig
494
495         
496         def restart(self, iface):
497                 system("start-stop-daemon -K -x /usr/sbin/wpa_supplicant")
498                 system("start-stop-daemon -S -x /usr/sbin/wpa_supplicant -- -B -i"+iface+" -c/etc/wpa_supplicant.conf")
499
500 class Status:
501         def __init__(self):
502                 self.wlaniface = {}
503                 self.backupwlaniface = {}
504                 self.WlanConsole = Console()
505
506         def stopWlanConsole(self):
507                 if self.WlanConsole is not None:
508                         print "killing self.WlanConsole"
509                         self.WlanConsole = None
510                         
511         def getDataForInterface(self, iface, callback = None):
512                 self.WlanConsole = Console()
513                 cmd = "iwconfig " + iface
514                 self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
515
516         def iwconfigFinished(self, result, retval, extra_args):
517                 (iface, callback) = extra_args
518                 data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
519                 for line in result.splitlines():
520                         line = line.strip()
521                         if "ESSID" in line:
522                                 if "off/any" in line:
523                                         ssid = _("No Connection")
524                                 else:
525                                         tmpssid=(line[line.index('ESSID')+7:len(line)-1])
526                                         if tmpssid == '':
527                                                 ssid = _("Hidden networkname")
528                                         elif tmpssid ==' ':
529                                                 ssid = _("Hidden networkname")
530                                         else:
531                                             ssid = tmpssid
532                                 #print "SSID->",ssid
533                                 if ssid is not None:
534                                         data['essid'] = ssid
535                         if 'Frequency' in line:
536                                 frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
537                                 #print "Frequency",frequency   
538                                 if frequency is not None:
539                                         data['frequency'] = frequency
540                         if "Access Point" in line:
541                                 ap=line[line.index('Access Point')+14:len(line)]
542                                 #print "AP",ap
543                                 if ap is not None:
544                                         data['acesspoint'] = ap
545                                         if ap == "Not-Associated":
546                                                 data['essid'] = _("No Connection")
547                         if "Bit Rate" in line:
548                                 if "kb" in line:
549                                         br = line[line.index('Bit Rate')+9 :line.index(' kb/s')]
550                                         if br == '0':
551                                                 br = _("Unsupported")
552                                         else:
553                                                 br += " Mb/s"
554                                 else:
555                                         br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
556                                 #print "Bitrate",br
557                                 if br is not None:
558                                         data['bitrate'] = br
559                         if 'Encryption key' in line:
560                                 if ":off" in line:
561                                         if data['acesspoint'] is not "Not-Associated":
562                                                 enc = _("Unsupported")
563                                         else:
564                                                 enc = _("Disabled")
565                                 else:
566                                         enc = line[line.index('Encryption key')+15 :line.index('   Security')]
567                                         if enc is not None:
568                                                 enc = _("Enabled")
569                                 #print "Encryption key",enc 
570                                 if enc is not None:
571                                         data['encryption'] = enc
572                         if 'Quality' in line:
573                                 if "/100" in line:
574                                         qual = line[line.index('Quality')+8:line.index('/100')]
575                                 else:
576                                         qual = line[line.index('Quality')+8:line.index('Sig')]
577                                 #print "Quality",qual
578                                 if qual is not None:
579                                         data['quality'] = qual
580                         if 'Signal level' in line:
581                                 if "dBm" in line:
582                                         signal = line[line.index('Signal level')+14 :line.index(' dBm')]
583                                         signal += " dBm"
584                                 elif "/100" in line:
585                                         signal = line[line.index('Signal level')+13:line.index('/100  Noise')]
586                                         signal += "%"
587                                 else:
588                                         signal = line[line.index('Signal level')+13:line.index('  Noise')]
589                                         signal += "%"
590                                 #print "Signal level",signal            
591                                 if signal is not None:
592                                         data['signal'] = signal
593
594                 self.wlaniface[iface] = data
595                 self.backupwlaniface = self.wlaniface
596                 
597                 if self.WlanConsole is not None:
598                         if len(self.WlanConsole.appContainers) == 0:
599                                 print "self.wlaniface after loading:", self.wlaniface
600                                 if callback is not None:
601                                         callback(True,self.wlaniface)
602
603         def getAdapterAttribute(self, iface, attribute):
604                 print "im getAdapterAttribute"
605                 self.iface = iface
606                 if self.wlaniface.has_key(self.iface):
607                         print "self.wlaniface.has_key",self.iface
608                         if self.wlaniface[self.iface].has_key(attribute):
609                                 return self.wlaniface[self.iface][attribute]
610                 return None
611         
612 iStatus = Status()