Browse Source

Removed dependency on networksetup to get list of network interfaces

tags/v1.0.0
Robert Klep 9 years ago
parent
commit
9d3590f27f
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      ToggleProxy.py

+ 3
- 2
ToggleProxy.py View File

@@ -65,8 +65,9 @@ class ToggleProxy(NSObject):
def loadNetworkServices(self):
""" load list of network services """
self.services = {}
output = commands.getoutput("/usr/sbin/networksetup listnetworkserviceorder")
for servicename, service, device in re.findall(r'\(\d\)\s*(.*?)(?:\n|\r\n?)\(Hardware Port:\s*(.*?), Device:\s*(.*?)\)', output, re.MULTILINE):
for interface in SCNetworkInterfaceCopyAll():
device = SCNetworkInterfaceGetBSDName(interface)
servicename = SCNetworkInterfaceGetLocalizedDisplayName(interface)
self.services[device] = servicename

def watchForProxyChanges(self):


Loading…
Cancel
Save