当前位置: 首页>>代码示例>>Python>>正文


Python Wireless.getWirelessName方法代码示例

本文整理汇总了Python中pythonwifi.iwlibs.Wireless.getWirelessName方法的典型用法代码示例。如果您正苦于以下问题:Python Wireless.getWirelessName方法的具体用法?Python Wireless.getWirelessName怎么用?Python Wireless.getWirelessName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pythonwifi.iwlibs.Wireless的用法示例。


在下文中一共展示了Wireless.getWirelessName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: iwconfig

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getWirelessName [as 别名]
def iwconfig(interface):
    """ Get wireless information from the device driver. """
    if interface not in getWNICnames():
        print "%-8.16s  no wireless extensions." % (interface, )
    else:
        wifi = Wireless(interface)
        print """%-8.16s  %s  ESSID:"%s" """ % (interface,
            wifi.getWirelessName(), wifi.getEssid())
        if (wifi.wireless_info.getMode() == pythonwifi.flags.IW_MODE_ADHOC):
            ap_type = "Cell"
        else:
            ap_type = "Access Point"
        ap_addr = wifi.getAPaddr()
        if (ap_addr == "00:00:00:00:00:00"):
            ap_addr = "Not-Associated"
        print """          Mode:%s  Frequency:%s  %s: %s""" % (
            wifi.getMode(), wifi.getFrequency(), ap_type, ap_addr)

        # Bit Rate, TXPower, and Sensitivity line
        line = "          "
        bitrate = getBitrate(wifi)
        if bitrate:
            line = line + bitrate
        txpower = getTXPower(wifi)
        if txpower:
            line = line + txpower
        sensitivity = getSensitivity(wifi)
        if sensitivity:
            line = line + sensitivity
        print line

        # Retry, RTS, and Fragmentation line
        line = "          "
        retry = getRetrylimit(wifi)
        if retry:
            line = line + retry
        rts = getRTS(wifi)
        if rts:
            line = line + rts
        fragment = getFragmentation(wifi)
        if fragment:
            line = line + fragment
        print line

        # Encryption line
        line = "          "
        line = line + getEncryption(wifi)
        print line

        # Power Management line
        line = "          "
        line = line + getPowerManagement(wifi)
        print line

        stat, qual, discard, missed_beacon = wifi.getStatistics()

        # Link Quality, Signal Level and Noise Level line
        line = "          "
        line = line + "Link Quality:%s/100  " % (qual.quality, )
        line = line + "Signal level:%sdBm  " % (qual.signallevel, )
        line = line + "Noise level:%sdBm" % (qual.noiselevel, )
        print line

        # Rx line
        line = "          "
        line = line + "Rx invalid nwid:%s  " % (discard['nwid'], )
        line = line + "Rx invalid crypt:%s  " % (discard['code'], )
        line = line + "Rx invalid frag:%s" % (discard['fragment'], )
        print line

        # Tx line
        line = "          "
        line = line + "Tx excessive retries:%s  " % (discard['retries'], )
        line = line + "Invalid misc:%s   " % (discard['misc'], )
        line = line + "Missed beacon:%s" % (missed_beacon, )
        print line

    print
开发者ID:Thearith,项目名称:cg3002py,代码行数:80,代码来源:iwconfig.py

示例2: iwconfig

# 需要导入模块: from pythonwifi.iwlibs import Wireless [as 别名]
# 或者: from pythonwifi.iwlibs.Wireless import getWirelessName [as 别名]
def iwconfig(interface):
    """ Get wireless information from the device driver. """
    if interface not in getWNICnames():
        print "%-8.16s  no wireless extensions." % (interface, )
    else:
        wifi = Wireless(interface)
        line = """%-8.16s  %s  """ % (interface, wifi.getWirelessName())
        if (wifi.getEssid()):
            line = line + """ESSID:"%s"  \n          """ % (wifi.getEssid(), )
        else:
            line = line + "ESSID:off/any  \n          "

        # Mode, Frequency, and Access Point
        line = line + "Mode:" + wifi.getMode()
        try:
            line = line + "  Frequency:" + wifi.getFrequency()
        except IOError, (error_number, error_string):
            # Some drivers do not return frequency info if not associated
            pass

        if (wifi.wireless_info.getMode() == pythonwifi.flags.IW_MODE_ADHOC):
            ap_type = "Cell"
        else:
            ap_type = "Access Point"
        ap_addr = wifi.getAPaddr()
        if (ap_addr == "00:00:00:00:00:00"):
            ap_addr = "Not-Associated"
        line = line + "  " + ap_type + ": " + ap_addr + "   "
        print line

        # Bit Rate, TXPower, and Sensitivity line
        line = "          "
        bitrate = getBitrate(wifi)
        if bitrate:
            line = line + bitrate
        txpower = getTXPower(wifi)
        if txpower:
            line = line + txpower
        sensitivity = getSensitivity(wifi)
        if sensitivity:
            line = line + sensitivity
        print line

        # Retry, RTS, and Fragmentation line
        line = "          "
        retry = getRetrylimit(wifi)
        if retry:
            line = line + retry
        rts = getRTS(wifi)
        if rts:
            line = line + rts
        fragment = getFragmentation(wifi)
        if fragment:
            line = line + fragment
        print line

        # Encryption line
        line = "          "
        line = line + getEncryption(wifi)
        print line

        # Power Management line
        line = "          "
        line = line + getPowerManagement(wifi)
        print line

        try:
            stat, qual, discard, missed_beacon = wifi.getStatistics()
        except IOError, (error_number, error_string):
            # Some drivers do not return statistics info if not associated
            pass
开发者ID:FomkaV,项目名称:wifi-arsenal,代码行数:73,代码来源:iwconfig.py


注:本文中的pythonwifi.iwlibs.Wireless.getWirelessName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。