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


Python data.MTU属性代码示例

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


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

示例1: read_packet

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def read_packet(self, size=MTU):
        rp = super(PcapReader, self).read_packet(size=size)
        if rp is None:
            raise EOFError
        s, pkt_info = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except Exception:
            if conf.debug_dissector:
                from scapy.sendrecv import debug
                debug.crashed_on = (self.LLcls, s)
                raise
            p = conf.raw_layer(s)
        power = Decimal(10) ** Decimal(-9 if self.nano else -6)
        p.time = EDecimal(pkt_info.sec + power * pkt_info.usec)
        p.wirelen = pkt_info.wirelen
        return p 
开发者ID:secdev,项目名称:scapy,代码行数:22,代码来源:utils.py

示例2: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, x=MTU):
        cls, val, ts = self.recv_raw(x)
        if not val or not cls:
            return
        try:
            pkt = cls(val)
        except KeyboardInterrupt:
            raise
        except Exception:
            if conf.debug_dissector:
                from scapy.sendrecv import debug
                debug.crashed_on = (cls, val)
                raise
            pkt = conf.raw_layer(val)
        if ts:
            pkt.time = ts
        return pkt 
开发者ID:secdev,项目名称:scapy,代码行数:19,代码来源:supersocket.py

示例3: recv_raw

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv_raw(self, x=MTU):
        try:
            data, address = self.ins.recvfrom(x)
        except io.BlockingIOError:
            return None, None, None
        from scapy.layers.inet import IP
        from scapy.layers.inet6 import IPv6
        if self.ipv6:
            # AF_INET6 does not return the IPv6 header. Let's build it
            # (host, port, flowinfo, scopeid)
            host, _, flowinfo, _ = address
            header = raw(IPv6(src=host,
                              dst=self.host_ip6,
                              fl=flowinfo,
                              nh=self.proto,  # fixed for AF_INET6
                              plen=len(data)))
            return IPv6, header + data, time.time()
        else:
            return IP, data, time.time() 
开发者ID:secdev,项目名称:scapy,代码行数:21,代码来源:native.py

示例4: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, x=MTU):
        return L2CAP_CmdHdr(self.ins.recv(x)) 
开发者ID:medbenali,项目名称:CyberScan,代码行数:4,代码来源:bluetooth.py

示例5: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, n=MTU):
        r = self.spb.recv(n)
        if self.proto is not None:
            r = self.proto(r)
        return r 
开发者ID:secdev,项目名称:scapy,代码行数:7,代码来源:automaton.py

示例6: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size=size)[0] 
开发者ID:secdev,项目名称:scapy,代码行数:6,代码来源:utils.py

示例7: __init__

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def __init__(self, filename, linktype=None, gz=False, endianness="",
                 append=False, sync=False, nano=False, snaplen=MTU):
        """
        :param filename: the name of the file to write packets to, or an open,
            writable file-like object.
        :param linktype: force linktype to a given value. If None, linktype is
            taken from the first writer packet
        :param gz: compress the capture on the fly
        :param endianness: force an endianness (little:"<", big:">").
            Default is native
        :param append: append packets to the capture file instead of
            truncating it
        :param sync: do not bufferize writes to the capture file
        :param nano: use nanosecond-precision (requires libpcap >= 1.5.0)

        """

        self.linktype = linktype
        self.snaplen = snaplen
        self.header_present = 0
        self.append = append
        self.gz = gz
        self.endian = endianness
        self.sync = sync
        self.nano = nano
        bufsz = 4096
        if sync:
            bufsz = 0

        if isinstance(filename, six.string_types):
            self.filename = filename
            self.f = [open, gzip.open][gz](filename, append and "ab" or "wb", gz and 9 or bufsz)  # noqa: E501
        else:
            self.f = filename
            self.filename = getattr(filename, "name", "No name") 
开发者ID:secdev,项目名称:scapy,代码行数:37,代码来源:utils.py

示例8: recv_raw

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv_raw(self, x=MTU):
        """Returns a tuple containing (cls, pkt_data, time)"""
        return conf.raw_layer, self.ins.recv(x), None 
开发者ID:secdev,项目名称:scapy,代码行数:5,代码来源:supersocket.py

示例9: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size=size) 
开发者ID:secdev,项目名称:scapy,代码行数:6,代码来源:can.py

示例10: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, x=MTU):
            return self.ins.recv(x) 
开发者ID:secdev,项目名称:scapy,代码行数:4,代码来源:usb.py

示例11: nonblock_recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def nonblock_recv(self, x=MTU):
        return self.recv()

    # https://docs.microsoft.com/en-us/windows/desktop/winsock/tcp-ip-raw-sockets-2  # noqa: E501
    # - For IPv4 (address family of AF_INET), an application receives the IP
    # header at the front of each received datagram regardless of the
    # IP_HDRINCL socket option.
    # - For IPv6 (address family of AF_INET6), an application receives
    # everything after the last IPv6 header in each received datagram
    # regardless of the IPV6_HDRINCL socket option. The application does
    # not receive any IPv6 headers using a raw socket. 
开发者ID:secdev,项目名称:scapy,代码行数:13,代码来源:native.py

示例12: nonblock_recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def nonblock_recv(self):
        """Receives and dissect a packet in non-blocking mode.
        Note: on Windows, this won't do anything."""
        self.ins.setnonblock(1)
        p = self.recv(MTU)
        self.ins.setnonblock(0)
        return p 
开发者ID:secdev,项目名称:scapy,代码行数:9,代码来源:pcapdnet.py

示例13: __init__

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def __init__(self, iface=None, type=ETH_P_ALL, promisc=None, filter=None, monitor=None):  # noqa: E501
            super(L2pcapListenSocket, self).__init__()
            self.type = type
            self.outs = None
            self.iface = iface
            if iface is None:
                iface = conf.iface
            if promisc is None:
                promisc = conf.sniff_promisc
            self.promisc = promisc
            # Note: Timeout with Winpcap/Npcap
            #   The 4th argument of open_pcap corresponds to timeout. In an ideal world, we would  # noqa: E501
            # set it to 0 ==> blocking pcap_next_ex.
            #   However, the way it is handled is very poor, and result in a jerky packet stream.  # noqa: E501
            # To fix this, we set 100 and the implementation under windows is slightly different, as  # noqa: E501
            # everything is always received as non-blocking
            self.ins = open_pcap(iface, MTU, self.promisc, 100,
                                 monitor=monitor)
            try:
                ioctl(self.ins.fileno(), BIOCIMMEDIATE, struct.pack("I", 1))
            except Exception:
                pass
            if type == ETH_P_ALL:  # Do not apply any filter if Ethernet type is given  # noqa: E501
                if conf.except_filter:
                    if filter:
                        filter = "(%s) and not (%s)" % (filter, conf.except_filter)  # noqa: E501
                    else:
                        filter = "not (%s)" % conf.except_filter
                if filter:
                    self.ins.setfilter(filter) 
开发者ID:secdev,项目名称:scapy,代码行数:32,代码来源:pcapdnet.py

示例14: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, x=MTU):
            r = L2pcapSocket.recv(self, x)
            if r:
                r.payload.time = r.time
                return r.payload
            return r 
开发者ID:secdev,项目名称:scapy,代码行数:8,代码来源:pcapdnet.py

示例15: recv

# 需要导入模块: from scapy import data [as 别名]
# 或者: from scapy.data import MTU [as 别名]
def recv(self, x=MTU):
        pkt = super(ISOTP_ENETSocket, self).recv(x)
        return self.outputcls(bytes(pkt[1])) 
开发者ID:secdev,项目名称:scapy,代码行数:5,代码来源:enet.py


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