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


Python pcapy.findalldevs方法代码示例

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


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

示例1: getInterface

# 需要导入模块: import pcapy [as 别名]
# 或者: from pcapy import findalldevs [as 别名]
def getInterface():
    # Grab a list of interfaces that pcap is able to listen on.
    # The current user will be able to listen from all returned interfaces,
    # using open_live to open them.
    ifs = findalldevs()

    # No interfaces available, abort.
    if 0 == len(ifs):
        print "You don't have enough permissions to open any interface on this system."
        sys.exit(1)

    # Only one interface available, use it.
    elif 1 == len(ifs):
        print 'Only one interface present, defaulting to it.'
        return ifs[0]

    # Ask the user to choose an interface from the list.
    count = 0
    for iface in ifs:
        print '%i - %s' % (count, iface)
        count += 1
    idx = int(raw_input('Please select an interface: '))

    return ifs[idx] 
开发者ID:knightmare2600,项目名称:d4rkc0de,代码行数:26,代码来源:sniff.py

示例2: getInterface

# 需要导入模块: import pcapy [as 别名]
# 或者: from pcapy import findalldevs [as 别名]
def getInterface():
    # Grab a list of interfaces that pcap is able to listen on.
    # The current user will be able to listen from all returned interfaces,
    # using open_live to open them.
    ifs = findalldevs()

    # No interfaces available, abort.
    if 0 == len(ifs):
        print("You don't have enough permissions to open any interface on this system.")
        sys.exit(1)

    # Only one interface available, use it.
    elif 1 == len(ifs):
        print('Only one interface present, defaulting to it.')
        return ifs[0]

    # Ask the user to choose an interface from the list.
    count = 0
    for iface in ifs:
        print('%i - %s' % (count, iface))
        count += 1
    idx = int(input('Please select an interface: '))

    return ifs[idx] 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:26,代码来源:sniff.py

示例3: canvas_detect

# 需要导入模块: import pcapy [as 别名]
# 或者: from pcapy import findalldevs [as 别名]
def canvas_detect(self):
        self.lilnew1.delete(0, END)
        holddevices=pcapy.findalldevs()
	for devices in holddevices:
            if devices=="any":
                self.lilnew1.insert(0, )    
	    elif devices=="lo": 
		self.lilnew1.insert(0, )      
            else:
                self.lilnew1.insert(0, devices) 
开发者ID:hiteshchoudhary,项目名称:Airvengers,代码行数:12,代码来源:Airtun-ng.py

示例4: __init__

# 需要导入模块: import pcapy [as 别名]
# 或者: from pcapy import findalldevs [as 别名]
def __init__(self, iface, filename='test.pcap', pcFilter=None, num_packets=3000):
        # list all the network devices
        # print pcapy.findalldevs()

        max_bytes = 1024
        promiscuous = False
        read_timeout = 100  # in milliseconds
        pc = pcapy.open_live(iface, max_bytes, promiscuous, read_timeout)
        if pcFilter: pc.setfilter(pcFilter)
        self.dumper = pc.dump_open(filename)
        pc.loop(num_packets, self.recv_pkts)  # capture packets

    # callback for received packets 
开发者ID:AllGloryToTheHypnotoad,项目名称:netscan2,代码行数:15,代码来源:lib.py

示例5: getInterfaces

# 需要导入模块: import pcapy [as 别名]
# 或者: from pcapy import findalldevs [as 别名]
def getInterfaces():
    # Grab a list of interfaces that pcap is able to listen on.
    # The current user will be able to listen from all returned interfaces,
    # using open_live to open them.
    ifs = findalldevs()

    # No interfaces available, abort.
    if 0 == len(ifs):
        return "You don't have enough permissions to open any interface on this system."

    return ifs 
开发者ID:tholum,项目名称:PiBunny,代码行数:13,代码来源:tracer.py


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