diff --git a/wicd/networking.py b/wicd/networking.py index 609e50a..ef4208e 100644 --- a/wicd/networking.py +++ b/wicd/networking.py @@ -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() diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index 33958c3..0f4704a 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -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, diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 8a7f3f0..3bf22d0 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -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: