Beispiel #1
0
    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
Beispiel #2
0
    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")
Beispiel #3
0
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
Beispiel #4
0
 def writeConfig(self, iface):
     if iNetwork.useWlCommand(iface):
         res = self.writeWlConf(iface)
     else:
         res = self.writeWpasupplicantConf(iface)
Beispiel #5
0
 def loadConfig(self, iface):
     if iNetwork.useWlCommand(iface):
         wsconf = self.readWlConf(iface)
     else:
         wsconf = self.readWpaSupplicantConf(iface)
     return wsconf