def deActivateIface(self): if self.oldInterfaceState is not True: os.system("ifconfig " + self.iface + " down") iNetwork.setAdapterAttribute(self.iface, "up", False) if iNetwork.useWlCommand(self.iface): os.system("wl down") self.oldInterfaceState = None
def activateIface(self): if self.oldInterfaceState is None: self.oldInterfaceState = iNetwork.getAdapterAttribute( self.iface, "up") if self.oldInterfaceState is not True: os.system("ifconfig " + self.iface + " up") iNetwork.setAdapterAttribute(self.iface, "up", True) if iNetwork.useWlCommand(self.iface): os.system("wl up")
def getConfigStrings(iface): contents = '' if iNetwork.useWlCommand(iface): essid = config.plugins.wlan.essid.value encryption = config.plugins.wlan.encryption.value key = config.plugins.wlan.psk.value encryption = { "Unencrypted": "None", "WEP": "wep", "WPA": "wpa", "WPA2": "wpa2" }.get(encryption, "wpa2") contents = '\tpre-up wl-config.sh -m %s -k "%s" -s "%s" \n' % ( encryption, key, essid) contents += '\tpost-down wl-down.sh\n' else: ws = wpaSupplicant() wpaSupplicantName = ws.getWpaSupplicantName(iface) contents = "\tpre-up wpa_supplicant -i" + iface + " -c%s -B -D" % ( wpaSupplicantName) + iNetwork.detectWlanModule(iface) + "\n" contents += "\tpost-down wpa_cli terminate\n" #print "[getConfigStrings] : ", contents return contents
def writeConfig(self, iface): if iNetwork.useWlCommand(iface): res = self.writeWlConf(iface) else: res = self.writeWpasupplicantConf(iface)
def loadConfig(self, iface): if iNetwork.useWlCommand(iface): wsconf = self.readWlConf(iface) else: wsconf = self.readWpaSupplicantConf(iface) return wsconf