1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-24 07:02:29 +01:00

Adding available auth methods

This commit is contained in:
Dario Freddi
2009-03-01 20:19:16 +01:00
parent 9213c7c333
commit 23cb084036
3 changed files with 29 additions and 1 deletions

View File

@@ -645,6 +645,16 @@ class Wireless(Controller):
"""
return self.wiface.GetOperationalMode(iwconfig)
def GetAvailableAuthMethods(self, iwlistauth):
""" Get the available authentication methods for the interface.
Returns:
The available authentication methods of the interface as a string, or
None if the auth methods can't be found.
"""
return self.wiface.GetAvailableAuthMethods(iwlistauth)
def GetIwconfig(self):
""" Get the out of iwconfig. """
return self.wiface.GetIwconfig()

View File

@@ -1003,7 +1003,12 @@ class WirelessDaemon(dbus.service.Object):
@dbus.service.method('org.wicd.daemon.wireless')
def GetOperationalMode(self, iwconfig):
""" Returns the operational mode for the iwconfig parameter """
return misc.to_unicode(self.wifi.GetOperationalMode())
return misc.to_unicode(self.wifi.GetOperationalMode(iwconfig))
@dbus.service.method('org.wicd.daemon.wireless')
def GetAvailableAuthMethods(self, iwlistauth):
""" Returns the operational mode for the iwlistauth parameter """
return misc.to_unicode(self.wifi.GetAvailableAuthMethods(iwlistauth))
@dbus.service.method('org.wicd.daemon.wireless')
def CreateAdHocNetwork(self, essid, channel, ip, enctype, key, encused,

View File

@@ -63,6 +63,7 @@ ip_pattern = re.compile(r'inet [Aa]d?dr[^.]*:([^.]*\.[^.]*\.[^.]*\.[0-9]*)',re.S
bssid_pattern = re.compile('.*Access Point: (([0-9A-Z]{2}:){5}[0-9A-Z]{2})', __re_mode)
bitrate_pattern = re.compile('.*Bit Rate=(.*?)s', __re_mode)
opmode_pattern = re.compile('.*Mode:(.*?) ', __re_mode)
authmethods_pattern = re.compile('.*Authentication capabilities :\n(.*?)Current', __re_mode)
# Regular expressions for wpa_cli output
auth_pattern = re.compile('.*wpa_state=(.*?)\n', __re_mode)
@@ -1211,6 +1212,18 @@ class BaseWirelessInterface(BaseInterface):
opmode = misc.RunRegex(opmode_pattern, output)
return opmode
def GetAvailableAuthMethods(self, iwlistauth=None):
""" Get the MAC address for the interface. """
if not iwlistauth:
cmd = 'iwlist ' + self.iface + ' auth'
if self.verbose: print cmd
output = misc.Run(cmd)
else:
output = iwlistauth
authm = misc.RunRegex(authmethods_pattern, output).replace(' ', '').replace('\t', '').replace('\n', '; ')[:-2]
return authm
def _get_link_quality(self, output):
""" Parse out the link quality from iwlist scan or iwconfig output. """
try: