當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。