本文整理汇总了Python中pythonwifi.iwlibs.Wireless.getChannelInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Wireless.getChannelInfo方法的具体用法?Python Wireless.getChannelInfo怎么用?Python Wireless.getChannelInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythonwifi.iwlibs.Wireless
的用法示例。
在下文中一共展示了Wireless.getChannelInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getNetworkList
# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getChannelInfo [as 别名]
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")
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)]
# noinspection PyProtectedMember
aps[bssid] = {
"active": True,
"bssid": result.bssid,
"channel": frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
"encrypted": encryption,
"essid": strip(self.asciify(result.essid)),
"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
示例2: getNetworkList
# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getChannelInfo [as 别名]
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)
enigma.eConsoleAppContainer().execute("ifconfig %s up" % self.iface)
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)]
# noinspection PyProtectedMember
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'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
示例3: getNetworkList
# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getChannelInfo [as 别名]
def getNetworkList(self):
system("ifconfig "+self.iface+" up")
ifobj = Wireless(self.iface) # a Wireless NIC Object
#Association mappings
#stats, quality, discard, missed_beacon = ifobj.getStatistics()
#snr = quality.signallevel - quality.noiselevel
try:
scanresults = ifobj.scan()
except:
scanresults = None
print "[Wlan.py] No Wireless Networks could be found"
if scanresults is not None:
aps = {}
(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:
print element
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)]
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'iface': self.iface,
'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
'noise' : '',#result.quality.nlevel-0x100,
'quality' : str(quality),
'signal' : str(signal),
'custom' : extra,
}
#print "GOT APS ENTRY:",aps[bssid]
index = index + 1
return aps