Ejemplo n.º 1
0
def configStrings(iface):
	hardware_info = HardwareInfo()
	if  hardware_info.device_name != "dm7025":
		rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
		etpm = eTPM()
		l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
		if l2cert is None:
			return
		l2key = validate_cert(l2cert, rootkey)
		if l2key is None:
			return
		l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
		if l3cert is None:
			print "better run the genuine dreambox plugin"
			return
		l3key = validate_cert(l3cert, l2key)
		if l3key is None:
			return
		rnd = read_random()
		if rnd is None:
			return
		val = etpm.challenge(rnd)
		result = decrypt_block(val, l3key)
	if hardware_info.device_name == "dm7025" or result[80:88] == rnd:
		driver = iNetwork.detectWlanModule(iface)
	else:
		driver = 'dreambox'
	if driver  in ('ralink', 'zydas'):
		return "	pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n	post-down wpa_cli terminate"
	else:
		if config.plugins.wlan.essid.value == "hidden...":
			return '	pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n	pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	post-down wpa_cli terminate'
		else:
			return '	pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n	pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	post-down wpa_cli terminate'
Ejemplo n.º 2
0
 def getNetworkList(self):
     if self.oldInterfaceState is None:
         self.oldInterfaceState = iNetwork.getAdapterAttribute(
             self.iface, "up")
     if self.oldInterfaceState is False:
         if iNetwork.getAdapterAttribute(self.iface, "up") is False:
             iNetwork.setAdapterAttribute(self.iface, "up", True)
             Console().ePopen(
                 ["/sbin/ifconfig", "/sbin/ifconfig", self.iface, "up"])
             driver = iNetwork.detectWlanModule(self.iface)
             if driver == "brcm-wl":
                 Console().ePopen(["/usr/bin/wl", "/usr/bin/wl", "up"])
     try:
         scanResults = list(Cell.all(self.iface, 5))
         print("[Wlan] Scan results = '%s'." % scanResults)
     except Exception:
         scanResults = None
         print("[Wlan] No wireless networks could be found.")
     aps = {}
     if scanResults:
         for i in range(len(scanResults)):
             bssid = scanResults[i].ssid
             aps[bssid] = {
                 "active":
                 True,
                 "bssid":
                 scanResults[i].ssid,
                 "essid":
                 scanResults[i].ssid,
                 "channel":
                 scanResults[i].channel,
                 "encrypted":
                 scanResults[i].encrypted,
                 "encryption_type":
                 scanResults[i].encryption_type
                 if scanResults[i].encrypted else "none",
                 "iface":
                 self.iface,
                 "maxrate":
                 scanResults[i].bitrates,
                 "mode":
                 scanResults[i].mode,
                 "quality":
                 scanResults[i].quality,
                 "signal":
                 scanResults[i].signal,
                 "frequency":
                 scanResults[i].frequency,
                 "frequency_norm":
                 scanResults[i].frequency_norm,
                 "address":
                 scanResults[i].address,
                 "noise":
                 scanResults[i].noise,
                 "pairwise_ciphers":
                 scanResults[i].pairwise_ciphers,
                 "authentication_suites":
                 scanResults[i].authentication_suites,
             }
     return aps
Ejemplo n.º 3
0
def configStrings(iface):
    driver = iNetwork.detectWlanModule(iface)
    ret = ""
    if driver == 'madwifi' and config.plugins.wlan.essid.value == "hidden...":
        ret += "\tpre-up iwconfig " + iface + " essid \"" + config.plugins.wlan.hiddenessid.value + "\" || true\n"
    ret += "\tpre-up wpa_supplicant -i" + iface + " -c/etc/wpa_supplicant.conf -B -dd -D" + driver + " || true\n"
    ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
    return ret
Ejemplo n.º 4
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if driver == 'madwifi' and config.plugins.wlan.essid.value == "hidden...":
		ret += "\tpre-up iwconfig " + iface + " essid \"" + config.plugins.wlan.hiddenessid.value + "\" || true\n"
	ret += "\tpre-up wpa_supplicant -i" + iface + " -c/etc/wpa_supplicant.conf -B -dd -D" + driver + " || true\n"
	ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 5
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
	ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 6
0
 def stopGetNetworkList(self):
     if self.oldInterfaceState is not None:
         if self.oldInterfaceState is False:
             iNetwork.setAdapterAttribute(self.iface, "up", False)
             system("ifconfig " + self.iface + " down")
             if iNetwork.detectWlanModule(self.iface) == 'wl':
                 system("wl down")
             self.oldInterfaceState = None
             self.iface = None
Ejemplo n.º 7
0
def configStrings(iface):
    driver = iNetwork.detectWlanModule()
    print "Found WLAN-Driver:", driver
    if driver in ('ralink', 'zydas'):
        return "	pre-up /usr/sbin/wpa_supplicant -i" + iface + " -c/etc/wpa_supplicant.conf -B -D" + driver + "\n	post-down wpa_cli terminate"
    else:
        if config.plugins.wlan.essid.value == "hidden...":
            return '	pre-up iwconfig ' + iface + ' essid "' + config.plugins.wlan.hiddenessid.value + '"\n	pre-up /usr/sbin/wpa_supplicant -i' + iface + ' -c/etc/wpa_supplicant.conf -B -dd -D' + driver + '\n	post-down wpa_cli terminate'
        else:
            return '	pre-up iwconfig ' + iface + ' essid "' + config.plugins.wlan.essid.value + '"\n	pre-up /usr/sbin/wpa_supplicant -i' + iface + ' -c/etc/wpa_supplicant.conf -B -dd -D' + driver + '\n	post-down wpa_cli terminate'
Ejemplo n.º 8
0
	def stopGetNetworkList(self):
		if self.oldInterfaceState is not None:
			if self.oldInterfaceState is False:
				iNetwork.setAdapterAttribute(self.iface, "up", False)
				enigma.eConsoleAppContainer().execute("ifconfig %s down" % self.iface)
				driver = iNetwork.detectWlanModule(self.iface)
				if driver in ('brcm-wl', ):
					system("wl down")
				self.oldInterfaceState = None
				self.iface = None
Ejemplo n.º 9
0
	def stopGetNetworkList(self):
		if self.oldInterfaceState is not None:
			if self.oldInterfaceState is False:
				iNetwork.setAdapterAttribute(self.iface, "up", False)
				system("ifconfig "+self.iface+" down")
				driver = iNetwork.detectWlanModule(self.iface)
				if driver in ('brcm-wl', ):
					system("wl down")
				self.oldInterfaceState = None
				self.iface = None
Ejemplo n.º 10
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule()
	print "Found WLAN-Driver:",driver
	if driver  in ('ralink', 'zydas'):
		return "	pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n	post-down wpa_cli terminate"
	else:
		if config.plugins.wlan.essid.value == "hidden...":
			return '	pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n	pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	post-down wpa_cli terminate'
		else:
			return '	pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n	pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n	post-down wpa_cli terminate'
Ejemplo n.º 11
0
    def getNetworkList(self):
        if self.oldInterfaceState is None:
            self.oldInterfaceState = iNetwork.getAdapterAttribute(
                self.iface, "up")
        if self.oldInterfaceState is False:
            if iNetwork.getAdapterAttribute(self.iface, "up") is False:
                iNetwork.setAdapterAttribute(self.iface, "up", True)
                system("ifconfig " + self.iface + " up")
                driver = iNetwork.detectWlanModule(self.iface)
                if driver in ('brcm-wl', ):
                    system("wl up")

        scanresults = list(Cell.all(self.iface))
        aps = {}
        if scanresults is not None:
            for i in range(len(scanresults)):
                bssid = scanresults[i].ssid
                aps[bssid] = {
                    'active':
                    True,
                    'bssid':
                    scanresults[i].ssid,
                    'essid':
                    scanresults[i].ssid,
                    'channel':
                    scanresults[i].channel,
                    'encrypted':
                    scanresults[i].encrypted,
                    'encryption_type':
                    scanresults[i].encryption_type
                    if scanresults[i].encrypted else "none",
                    'iface':
                    self.iface,
                    'maxrate':
                    scanresults[i].bitrates,
                    'mode':
                    scanresults[i].mode,
                    'quality':
                    scanresults[i].quality,
                    'signal':
                    scanresults[i].signal,
                    'frequency':
                    scanresults[i].frequency,
                    'frequency_norm':
                    scanresults[i].frequency_norm,
                    'address':
                    scanresults[i].address,
                    'noise':
                    scanresults[i].noise,
                    'pairwise_ciphers':
                    scanresults[i].pairwise_ciphers,
                    'authentication_suites':
                    scanresults[i].authentication_suites,
                }
        return aps
Ejemplo n.º 12
0
 def stopGetNetworkList(self):
     if self.oldInterfaceState is not None:
         if self.oldInterfaceState is False:
             iNetwork.setAdapterAttribute(self.iface, "up", False)
             Console().ePopen(
                 ["/sbin/ifconfig", "/sbin/ifconfig", self.iface, "down"])
             driver = iNetwork.detectWlanModule(self.iface)
             if driver == "brcm-wl":
                 Console().ePopen(["/usr/bin/wl", "/usr/bin/wl", "down"])
             self.oldInterfaceState = None
             self.iface = None
Ejemplo n.º 13
0
def configStrings(iface):
    try:
        device = open("/proc/stb/info/model", "r").readline().strip()
    except:
        device = ""
    if device != "dm7025":
        rootkey = [
            '\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce',
            '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o',
            '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e',
            'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02',
            '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d',
            '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb',
            '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc',
            '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3',
            '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce',
            '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<',
            '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5',
            '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1',
            '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.',
            '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'
        ]
        etpm = eTPM()
        l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
        if l2cert is None:
            return
        l2key = validate_certificate(l2cert, rootkey)
        if l2key is None:
            return
        l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
        if l3cert is None:
            return
        l3key = validate_certificate(l3cert, l2key)
        if l3key is None:
            return
        rnd = get_random()
        if rnd is None:
            return
        val = etpm.challenge(rnd)
        result = decrypt_block(val, l3key)
    if device == "dm7025" or result[80:88] == rnd:
        driver = iNetwork.detectWlanModule(iface)
    else:
        driver = 'dreambox'
    print 'Using "%s" as wpa-supplicant driver' % (driver)
    ret = ""
    if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
        ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(
            config.plugins.wlan.essid.value) + "\" || true\n"
    ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(
        iface) + " -B -dd -D" + driver + " || true\n"
    ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
    return ret
Ejemplo n.º 14
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(config.plugins.wlan.essid.value) + "\" || true\n"

	if driver == 'wl':
		ret += '\tpre-up wl-config.sh -m %s -k %s -s "%s" \n' % ( config.plugins.wlan.encryption.value.lower(), re_escape(config.plugins.wlan.psk.value), config.plugins.wlan.essid.value)
		ret += '\tpost-down wl-down.sh\n'
	else:
		ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
		ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
def configStrings(iface):
    hardware_info = HardwareInfo()
    if hardware_info.device_name != "dm7025":
        rootkey = [
            '\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce',
            '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o',
            '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e',
            'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02',
            '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d',
            '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb',
            '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc',
            '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3',
            '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce',
            '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<',
            '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5',
            '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1',
            '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.',
            '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'
        ]
        etpm = eTPM()
        l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
        if l2cert is None:
            return
        l2key = validate_cert(l2cert, rootkey)
        if l2key is None:
            return
        l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
        if l3cert is None:
            print "better run the genuine dreambox plugin"
            return
        l3key = validate_cert(l3cert, l2key)
        if l3key is None:
            return
        rnd = read_random()
        if rnd is None:
            return
        val = etpm.challenge(rnd)
        result = decrypt_block(val, l3key)
    if hardware_info.device_name == "dm7025" or result[80:88] == rnd:
        driver = iNetwork.detectWlanModule(iface)
    else:
        driver = 'dreambox'
    if driver in ('ralink', 'zydas'):
        return "	pre-up /usr/sbin/wpa_supplicant -i" + iface + " -c/etc/wpa_supplicant.conf -B -D" + driver + "\n	post-down wpa_cli terminate"
    else:
        if config.plugins.wlan.essid.value == "hidden...":
            return '	pre-up iwconfig ' + iface + ' essid "' + config.plugins.wlan.hiddenessid.value + '"\n	pre-up /usr/sbin/wpa_supplicant -i' + iface + ' -c/etc/wpa_supplicant.conf -B -dd -D' + driver + '\n	post-down wpa_cli terminate'
        else:
            return '	pre-up iwconfig ' + iface + ' essid "' + config.plugins.wlan.essid.value + '"\n	pre-up /usr/sbin/wpa_supplicant -i' + iface + ' -c/etc/wpa_supplicant.conf -B -dd -D' + driver + '\n	post-down wpa_cli terminate'
Ejemplo n.º 16
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if existBcmWifi(iface):
		encryption = config.plugins.wlan.encryption.value
		psk = config.plugins.wlan.psk.value
		essid = config.plugins.wlan.essid.value
		ret += '\tpre-up wl-config.sh -m ' + encryption.lower() + ' -k ' + psk + ' -s "' + essid + '" \n'
		ret += '\tpost-down wl-down.sh\n'
	else:
		if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
			ret += "\tpre-up iwconfig " + iface + " essid \"" + re.escape(config.plugins.wlan.essid.value) + "\" || true\n"
		ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
		ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 17
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if existBcmWifi(iface):
		encryption = config.plugins.wlan.encryption.value
		psk = config.plugins.wlan.psk.value
		essid = config.plugins.wlan.essid.value
		ret += '\tpre-up wl-config.sh -m ' + encryption.lower() + ' -k ' + psk + ' -s "' + essid + '" \n'
		ret += '\tpost-down wl-down.sh\n'
	else:
		if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
			ret += "\tpre-up iwconfig " + iface + " essid \"" + re.escape(config.plugins.wlan.essid.value) + "\" || true\n"
		ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
		ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 18
0
def configStrings(iface):
    driver = iNetwork.detectWlanModule(iface)
    ret = ""
    if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
        ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(
            config.plugins.wlan.essid.value) + "\" || true\n"
    if driver == 'wl':
        ret += '\tpre-up wl-config.sh -m %s -k %s -s "%s" \n' % (
            config.plugins.wlan.encryption.value.lower(),
            re_escape(config.plugins.wlan.psk.value),
            config.plugins.wlan.essid.value)
        ret += '\tpost-down wl-down.sh\n'
    else:
        ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(
            iface) + " -B -dd -D" + driver + " || true\n"
        ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
    return ret
Ejemplo n.º 19
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if driver == "brcm-wl":
		encryption = config.plugins.wlan.encryption.value
		if encryption == "WPA/WPA2":
			encryption = "WPA2"
		encryption = encryption.lower()
		if encryption == "unencrypted":
			encryption = "None"
		ret += '\tpre-up wl-config.sh -m ' + encryption + ' -k ' + config.plugins.wlan.psk.value + ' -s \"' + config.plugins.wlan.essid.value + '\" || true\n'
		ret += '\tpost-down wl-down.sh || true\n'
		return ret
	if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re.escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
	if config.plugins.wlan.hiddenessid.value == True:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 20
0
def configStrings(iface):
	driver = iNetwork.detectWlanModule(iface)
	ret = ""
	if driver == "brcm-wl":
		encryption = config.plugins.wlan.encryption.value
		if encryption == "WPA/WPA2":
			encryption = "WPA2"
		encryption = encryption.lower()
		if encryption == "unencrypted":
			encryption = "None"
		ret += '\tpre-up wl-config.sh -m ' + encryption + ' -k ' + config.plugins.wlan.psk.value + ' -s \"' + config.plugins.wlan.essid.value + '\" || true\n'
		ret += '\tpost-down wl-down.sh || true\n'
		return ret
	if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re.escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
	if config.plugins.wlan.hiddenessid.value == True:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 21
0
def configStrings(iface):
#--->
#-	try:
#-		device = open("/proc/stb/info/model", "r").readline().strip()
#-	except:
#-		device = ""	
#-	if device != "dm7025":
#-		rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
#-		etpm = eTPM()
#-		l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
#-		if l2cert is None:
#-			return
#-		l2key = validate_certificate(l2cert, rootkey)
#-		if l2key is None:
#-			return
#-		l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
#-		if l3cert is None:
#-			return
#-		l3key = validate_certificate(l3cert, l2key)
#-		if l3key is None:
#-			return
#-		rnd = get_random()
#-		if rnd is None:
#-			return
#-		val = etpm.challenge(rnd)
#-		result = decrypt_block(val, l3key)
#-	if device == "dm7025" or result[80:88] == rnd:
#---<
	if True:
		driver = iNetwork.detectWlanModule(iface)
	else:
		driver = 'dreambox'
	print 'Using "%s" as wpa-supplicant driver' % (driver)
	ret = ""
	if driver == 'madwifi' and config.plugins.wlan.hiddenessid.value:
		ret += "\tpre-up iwconfig " + iface + " essid \"" + re_escape(config.plugins.wlan.essid.value) + "\" || true\n"
	ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n"
	ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n"
	return ret
Ejemplo n.º 22
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
Ejemplo n.º 23
0
    def getNetworkList(self):
        if self.oldInterfaceState is None:
            self.oldInterfaceState = iNetwork.getAdapterAttribute(
                self.iface, "up")
        if self.oldInterfaceState is False:
            if iNetwork.getAdapterAttribute(self.iface, "up") is False:
                iNetwork.setAdapterAttribute(self.iface, "up", True)
                system("ifconfig " + self.iface + " up")
                driver = iNetwork.detectWlanModule(self.iface)
                if driver in ('brcm-wl', ):
                    system("wl up")

        ifobj = Wireless(self.iface)  # a Wireless NIC Object

        try:
            scanresults = ifobj.scan()
        except:
            scanresults = None
            print "[Wlan.py] No wireless networks could be found"
        aps = {}
        if scanresults is not None:
            (num_channels, frequencies) = ifobj.getChannelInfo()
            index = 1
            for result in scanresults:
                bssid = result.bssid

                if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
                    encryption = False
                elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
                    encryption = True
                else:
                    encryption = None

                signal = str(result.quality.siglevel - 0x100) + " dBm"
                quality = "%s/%s" % (result.quality.quality,
                                     ifobj.getQualityMax().quality)

                extra = []
                for element in result.custom:
                    element = element.encode()
                    extra.append(strip(self.asciify(element)))
                for element in extra:
                    if 'SignalStrength' in element:
                        signal = element[element.index('SignalStrength') +
                                         15:element.index(',L')]
                    if 'LinkQuality' in element:
                        quality = element[element.index('LinkQuality') +
                                          12:len(element)]

                channel = "Unknown"
                try:
                    channel = frequencies.index(
                        ifobj._formatFrequency(
                            result.frequency.getFrequency())) + 1
                except:
                    channel = "Unknown"

                aps[bssid] = {
                    'active': True,
                    'bssid': result.bssid,
                    'channel': channel,
                    'encrypted': encryption,
                    'essid': result.essid and strip(self.asciify(result.essid))
                    or "",
                    'iface': self.iface,
                    'maxrate': ifobj._formatBitrate(result.rate[-1][-1]),
                    'noise': '',  #result.quality.nlevel-0x100,
                    'quality': str(quality),
                    'signal': str(signal),
                    'custom': extra,
                }

                index += 1
        return aps
Ejemplo n.º 24
0
def getWlanConfigName(iface):
    driver = iNetwork.detectWlanModule(iface)
    if driver in ('brcm-wl', ):
        return '/etc/wl.conf.' + iface
    return '/etc/wpa_supplicant.' + iface + '.conf'
Ejemplo n.º 25
0
def configStrings(iface):
    try:
        device = open("/usr/local/etc/stb/info/model", "r").readline().strip()
    except:
        device = ""
    if device != "e2pc":
        rootkey = [
            "\x9f",
            "|",
            "\xe4",
            "G",
            "\xc9",
            "\xb4",
            "\xf4",
            "#",
            "&",
            "\xce",
            "\xb3",
            "\xfe",
            "\xda",
            "\xc9",
            "U",
            "`",
            "\xd8",
            "\x8c",
            "s",
            "o",
            "\x90",
            "\x9b",
            "\\",
            "b",
            "\xc0",
            "\x89",
            "\xd1",
            "\x8c",
            "\x9e",
            "J",
            "T",
            "\xc5",
            "X",
            "\xa1",
            "\xb8",
            "\x13",
            "5",
            "E",
            "\x02",
            "\xc9",
            "\xb2",
            "\xe6",
            "t",
            "\x89",
            "\xde",
            "\xcd",
            "\x9d",
            "\x11",
            "\xdd",
            "\xc7",
            "\xf4",
            "\xe4",
            "\xe4",
            "\xbc",
            "\xdb",
            "\x9c",
            "\xea",
            "}",
            "\xad",
            "\xda",
            "t",
            "r",
            "\x9b",
            "\xdc",
            "\xbc",
            "\x18",
            "3",
            "\xe7",
            "\xaf",
            "|",
            "\xae",
            "\x0c",
            "\xe3",
            "\xb5",
            "\x84",
            "\x8d",
            "\r",
            "\x8d",
            "\x9d",
            "2",
            "\xd0",
            "\xce",
            "\xd5",
            "q",
            "\t",
            "\x84",
            "c",
            "\xa8",
            ")",
            "\x99",
            "\xdc",
            "<",
            '"',
            "x",
            "\xe8",
            "\x87",
            "\x8f",
            "\x02",
            ";",
            "S",
            "m",
            "\xd5",
            "\xf0",
            "\xa3",
            "_",
            "\xb7",
            "T",
            "\t",
            "\xde",
            "\xa7",
            "\xf1",
            "\xc9",
            "\xae",
            "\x8a",
            "\xd7",
            "\xd2",
            "\xcf",
            "\xb2",
            ".",
            "\x13",
            "\xfb",
            "\xac",
            "j",
            "\xdf",
            "\xb1",
            "\x1d",
            ":",
            "?",
        ]
        etpm = eTPM()
        l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
        if l2cert is None:
            return
        l2key = validate_certificate(l2cert, rootkey)
        if l2key is None:
            return
        l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
        if l3cert is None:
            return
        l3key = validate_certificate(l3cert, l2key)
        if l3key is None:
            return
        rnd = get_random()
        if rnd is None:
            return
        val = etpm.challenge(rnd)
        result = decrypt_block(val, l3key)
    if device == "e2pc" or result[80:88] == rnd:
        driver = iNetwork.detectWlanModule(iface)
    else:
        driver = "dreambox"
    print 'Using "%s" as wpa-supplicant driver' % (driver)
    ret = ""
    if driver != "dreambox" and config.plugins.wlan.hiddenessid.value:
        ret += "\tpre-up iwconfig " + iface + ' essid "' + re_escape(config.plugins.wlan.essid.value) + '" || true\n'
    ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -D" + driver + " -B\n"
    ret += "\tpost-down killall -q wpa_supplicant\n"

    return ret
Ejemplo n.º 26
0
def getWlanConfigName(iface):
	driver = iNetwork.detectWlanModule(iface)
	if driver in ('brcm-wl', ):
		return '/etc/wl.conf.' + iface
	return '/etc/wpa_supplicant.' + iface + '.conf'
Ejemplo n.º 27
0
	def getNetworkList(self):
		if self.oldInterfaceState is None:
			self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
		if self.oldInterfaceState is False:
			if iNetwork.getAdapterAttribute(self.iface, "up") is False:
				iNetwork.setAdapterAttribute(self.iface, "up", True)
				system("ifconfig "+self.iface+" up")
				driver = iNetwork.detectWlanModule(self.iface)
				if driver in ('brcm-wl', ):
					system("wl up")

		ifobj = Wireless(self.iface) # a Wireless NIC Object

		try:
			scanresults = ifobj.scan()
		except:
			scanresults = None
			print "[Wlan.py] No wireless networks could be found"
		aps = {}
		if scanresults is not None:
			(num_channels, frequencies) = ifobj.getChannelInfo()
			index = 1
			for result in scanresults:
				bssid = result.bssid

				if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
					encryption = False
				elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
					encryption = True
				else:
					encryption = None

				signal = str(result.quality.siglevel-0x100) + " dBm"
				quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)

				extra = []
				for element in result.custom:
					element = element.encode()
					extra.append( strip(self.asciify(element)) )
				for element in extra:
					if 'SignalStrength' in element:
						signal = element[element.index('SignalStrength')+15:element.index(',L')]
					if 'LinkQuality' in element:
						quality = element[element.index('LinkQuality')+12:len(element)]

				channel = "Unknown"
				try:
					channel = frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1
				except: channel = "Unknown"

				aps[bssid] = {
					'active' : True,
					'bssid': result.bssid,
					'channel': channel,
					'encrypted': encryption,
					'essid': result.essid and strip(self.asciify(result.essid)) or "",
					'iface': self.iface,
					'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
					'noise' : '',#result.quality.nlevel-0x100,
					'quality' : str(quality),
					'signal' : str(signal),
					'custom' : extra,
				}

				index += 1
		return aps
Ejemplo n.º 28
0
def getWlanConfigName(iface):
    driver = iNetwork.detectWlanModule(iface)
    if driver == "brcm-wl":
        return "/etc/wl.conf.%s" % iface
    return "/etc/wpa_supplicant.%s.conf" % iface