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


Python conf.L2socket方法代码示例

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


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

示例1: srp1flood

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def srp1flood(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs):  # noqa: E501
    """Flood and receive packets at layer 2 and return only the first answer

    :param prn:      function applied to packets received
    :param verbose:  set verbosity level
    :param nofilter: put 1 to avoid use of BPF filters
    :param filter:   provide a BPF filter
    :param iface:    listen answers only on the given interface
    """
    s = conf.L2socket(promisc=promisc, filter=filter, nofilter=nofilter, iface=iface)  # noqa: E501
    ans, _ = sndrcvflood(s, x, *args, **kargs)
    s.close()
    if len(ans) > 0:
        return ans[0][1]

# SNIFF METHODS 
开发者ID:secdev,项目名称:scapy,代码行数:18,代码来源:sendrecv.py

示例2: __init__

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def __init__(self, *args, **kargs):
        kargs.setdefault("ll", conf.L2socket)
        kargs.setdefault("monitor", True)
        super(KrackAP, self).__init__(*args, **kargs) 
开发者ID:secdev,项目名称:scapy,代码行数:6,代码来源:automaton.py

示例3: sendp

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None,
          verbose=None, realtime=None,
          return_packets=False, socket=None, *args, **kargs):
    """
    Send packets at layer 2

    :param x: the packets
    :param inter: time (in s) between two packets (default 0)
    :param loop: send packet indefinetly (default 0)
    :param count: number of packets to send (default None=1)
    :param verbose: verbose mode (default None=conf.verbose)
    :param realtime: check that a packet was sent before sending the next one
    :param return_packets: return the sent packets
    :param socket: the socket to use (default is conf.L3socket(kargs))
    :param iface: the interface to send the packets on
    :param monitor: (not on linux) send in monitor mode
    :returns: None
    """
    if iface is None and iface_hint is not None and socket is None:
        iface = conf.route.route(iface_hint)[0]
    need_closing = socket is None
    socket = socket or conf.L2socket(iface=iface, *args, **kargs)
    results = __gen_send(socket, x, inter=inter, loop=loop,
                         count=count, verbose=verbose,
                         realtime=realtime, return_packets=return_packets)
    if need_closing:
        socket.close()
    return results 
开发者ID:secdev,项目名称:scapy,代码行数:30,代码来源:sendrecv.py

示例4: srp

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def srp(x, promisc=None, iface=None, iface_hint=None, filter=None,
        nofilter=0, type=ETH_P_ALL, *args, **kargs):
    """
    Send and receive packets at layer 2
    """
    if iface is None and iface_hint is not None:
        iface = conf.route.route(iface_hint)[0]
    s = conf.L2socket(promisc=promisc, iface=iface,
                      filter=filter, nofilter=nofilter, type=type)
    result = sndrcv(s, x, *args, **kargs)
    s.close()
    return result 
开发者ID:secdev,项目名称:scapy,代码行数:14,代码来源:sendrecv.py

示例5: srpflood

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def srpflood(x, promisc=None, filter=None, iface=None, iface_hint=None, nofilter=None, *args, **kargs):  # noqa: E501
    """Flood and receive packets at layer 2

    :param prn:      function applied to packets received
    :param unique:   only consider packets whose print
    :param nofilter: put 1 to avoid use of BPF filters
    :param filter:   provide a BPF filter
    :param iface:    listen answers only on the given interface
    """
    if iface is None and iface_hint is not None:
        iface = conf.route.route(iface_hint)[0]
    s = conf.L2socket(promisc=promisc, filter=filter, iface=iface, nofilter=nofilter)  # noqa: E501
    r = sndrcvflood(s, x, *args, **kargs)
    s.close()
    return r 
开发者ID:secdev,项目名称:scapy,代码行数:17,代码来源:sendrecv.py

示例6: start

# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import L2socket [as 别名]
def start(self):
        self.s = conf.L2socket(iface=self.iface) 
开发者ID:secdev,项目名称:scapy,代码行数:4,代码来源:scapypipes.py


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