from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames
from pythonwifi import flags as wififlags
list = []
from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames
from pythonwifi import flags as wififlags
list = []
+config.plugins.wlan.encryption = NoSave(ConfigSelection(list, default = "WPA2"))
+config.plugins.wlan.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.psk = NoSave(ConfigPassword(default = "", fixed_size = False))
-config.plugins.wlan.encryption = ConfigSubsection()
-config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
-config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2"))
-config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
-config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
(num_channels, frequencies) = ifobj.getChannelInfo()
index = 1
for result in scanresults:
(num_channels, frequencies) = ifobj.getChannelInfo()
index = 1
for result in scanresults:
def writeConfig(self, iface):
essid = config.plugins.wlan.essid.value
hiddenessid = config.plugins.wlan.hiddenessid.value
def writeConfig(self, iface):
essid = config.plugins.wlan.essid.value
hiddenessid = config.plugins.wlan.hiddenessid.value
- encrypted = config.plugins.wlan.encryption.enabled.value
- encryption = config.plugins.wlan.encryption.type.value
- wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
- psk = config.plugins.wlan.encryption.psk.value
+ encryption = config.plugins.wlan.encryption.value
+ wepkeytype = config.plugins.wlan.wepkeytype.value
+ psk = config.plugins.wlan.psk.value
fp = file(getWlanConfigName(iface), 'w')
fp.write('#WPA Supplicant Configuration by enigma2\n')
fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
fp = file(getWlanConfigName(iface), 'w')
fp.write('#WPA Supplicant Configuration by enigma2\n')
fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
- if encrypted:
- if encryption in ('WPA', 'WPA2', 'WPA/WPA2'):
- fp.write('\tkey_mgmt=WPA-PSK\n')
-
- if encryption == 'WPA':
- fp.write('\tproto=WPA\n')
- fp.write('\tpairwise=TKIP\n')
- fp.write('\tgroup=TKIP\n')
- elif encryption == 'WPA2':
- fp.write('\tproto=RSN\n')
- fp.write('\tpairwise=CCMP\n')
- fp.write('\tgroup=CCMP\n')
- else:
- fp.write('\tproto=WPA RSN\n')
- fp.write('\tpairwise=CCMP TKIP\n')
- fp.write('\tgroup=CCMP TKIP\n')
- fp.write('\tpsk="'+psk+'"\n')
- elif encryption == 'WEP':
- fp.write('\tkey_mgmt=NONE\n')
- if wepkeytype == 'ASCII':
- fp.write('\twep_key0="'+psk+'"\n')
- else:
- fp.write('\twep_key0='+psk+'\n')
+ if encryption in ('WPA', 'WPA2', 'WPA/WPA2'):
+ fp.write('\tkey_mgmt=WPA-PSK\n')
+ if encryption == 'WPA':
+ fp.write('\tproto=WPA\n')
+ fp.write('\tpairwise=TKIP\n')
+ fp.write('\tgroup=TKIP\n')
+ elif encryption == 'WPA2':
+ fp.write('\tproto=RSN\n')
+ fp.write('\tpairwise=CCMP\n')
+ fp.write('\tgroup=CCMP\n')
+ else:
+ fp.write('\tproto=WPA RSN\n')
+ fp.write('\tpairwise=CCMP TKIP\n')
+ fp.write('\tgroup=CCMP TKIP\n')
+ fp.write('\tpsk="'+psk+'"\n')
+ elif encryption == 'WEP':
+ fp.write('\tkey_mgmt=NONE\n')
+ if wepkeytype == 'ASCII':
+ fp.write('\twep_key0="'+psk+'"\n')
+ else:
+ fp.write('\twep_key0='+psk+'\n')
for s in supplicant:
split = s.strip().split('=',1)
if split[0] == 'ap_scan':
for s in supplicant:
split = s.strip().split('=',1)
if split[0] == 'ap_scan':
wsconfig = {
'hiddenessid': config.plugins.wlan.hiddenessid.value,
'ssid': config.plugins.wlan.essid.value,
wsconfig = {
'hiddenessid': config.plugins.wlan.hiddenessid.value,
'ssid': config.plugins.wlan.essid.value,
- 'encryption': config.plugins.wlan.encryption.enabled.value,
- 'encryption_type': config.plugins.wlan.encryption.type.value,
- 'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
- 'key': config.plugins.wlan.encryption.psk.value,
+ 'encryption': config.plugins.wlan.encryption.value,
+ 'wepkeytype': config.plugins.wlan.wepkeytype.value,
+ 'key': config.plugins.wlan.psk.value,
- wsconfig['encryption'] = True
- if key == 'encryption_type':
- wsconfig['encryption_type'] = "WPA/WPA2"
- if key == 'encryption_wepkeytype':
- wsconfig['encryption_wepkeytype'] = "ASCII"
+ wsconfig['encryption'] = "WPA2"
+ if key == 'wepkeytype':
+ wsconfig['wepkeytype'] = "ASCII"
def getDataForInterface(self, iface, callback = None):
self.WlanConsole = Console()
cmd = "iwconfig " + iface
def getDataForInterface(self, iface, callback = None):
self.WlanConsole = Console()
cmd = "iwconfig " + iface
- self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
+ if callback is not None:
+ self.statusCallback = callback
+ self.WlanConsole.ePopen(cmd, self.iwconfigFinished, iface)
def iwconfigFinished(self, result, retval, extra_args):
def iwconfigFinished(self, result, retval, extra_args):
- (iface, callback) = extra_args
- data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
+ iface = extra_args
+ data = { 'essid': False, 'frequency': False, 'accesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
- tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
- if tmpssid in ('', ' '):
- ssid = _("Hidden networkname")
- else:
- ssid = tmpssid
+ ssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
- tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid in ('', ' '):
- ssid = _("Hidden networkname")
- else:
- ssid = tmpssid
+ ssid=(line[line.index('ESSID')+7:len(line)-1])
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
if self.WlanConsole is not None:
if len(self.WlanConsole.appContainers) == 0:
print "[Wlan.py] self.wlaniface after loading:", self.wlaniface
if self.WlanConsole is not None:
if len(self.WlanConsole.appContainers) == 0:
print "[Wlan.py] self.wlaniface after loading:", self.wlaniface
- if callback is not None:
- callback(True,self.wlaniface)
+ if self.statusCallback is not None:
+ self.statusCallback(True,self.wlaniface)
+ self.statusCallback = None