Python data 模块,MTU 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用data.MTU

项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self, size=size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """Read blocks until it reaches either EOF or a packet, and
        returns None or (packet, (linktype, sec, usec, wirelen)),
        where packet is a string.

        """
        while True:
            try:
                blocktype, blocklen = struct.unpack(self.endian + "2I",
                                                    self.f.read(8))
            except struct.error:
                return None
            block = self.f.read(blocklen - 12)
            try:
                if (blocklen,) != struct.unpack(self.endian + 'I',
                                                self.f.read(4)):
                    raise Scapy_Exception(
                        "Invalid pcapng block (bad blocklen)"
                    )
            except struct.error:
                return None
            res = self.blocktypes.get(blocktype,
                                      lambda block, size: None)(block, size)
            if res is not None:
                return res
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:isf    作者:w3h    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self, size=size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:isf    作者:w3h    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """Read blocks until it reaches either EOF or a packet, and
        returns None or (packet, (linktype, sec, usec, wirelen)),
        where packet is a string.

        """
        while True:
            try:
                blocktype, blocklen = struct.unpack(self.endian + "2I",
                                                    self.f.read(8))
            except struct.error:
                return None
            block = self.f.read(blocklen - 12)
            try:
                if (blocklen,) != struct.unpack(self.endian + 'I',
                                                self.f.read(4)):
                    raise Scapy_Exception(
                        "Invalid pcapng block (bad blocklen)"
                    )
            except struct.error:
                return None
            res = self.blocktypes.get(blocktype,
                                      lambda block, size: None)(block, size)
            if res is not None:
                return res
项目:scapy-vxlan    作者:p4lang    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp

        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p
项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:CyberScan    作者:medbenali    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:CVE-2016-6366    作者:RiskSense-Ops    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:trex-http-proxy    作者:alwye    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:size]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size=size)[0]
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size=size)
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet()
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:scapy-bpf    作者:guedou    | 项目源码 | 文件源码
def recv(self, n=MTU):
        r = self.spa.recv(n)
        if self.proto is not None:
            r = self.proto(r)
        return r
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)
项目:scapy-radio    作者:BastilleResearch    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:isf    作者:w3h    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:size]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:isf    作者:w3h    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size=size)[0]
项目:isf    作者:w3h    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size=size)
项目:isf    作者:w3h    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet()
项目:isf    作者:w3h    | 项目源码 | 文件源码
def _write_header(self, pkt):
        self.header_present=1

        if self.append:
            # Even if prone to race conditions, this seems to be
            # safest way to tell whether the header is already present
            # because we have to handle compressed streams that
            # are not as flexible as basic files
            g = [open,gzip.open][self.gz](self.filename,"rb")
            if g.read(16):
                return

        self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
                                 2, 4, 0, 0, MTU, self.linktype))
        self.f.flush()
项目:isf    作者:w3h    | 项目源码 | 文件源码
def recv(self, n=MTU):
        r = self.spa.recv(n)
        if self.proto is not None:
            r = self.proto(r)
        return r
项目:scapy-vxlan    作者:p4lang    | 项目源码 | 文件源码
def read_packet(self, size=MTU):
        """return a single packet read from the file

        returns None when no more packets are available
        """
        hdr = self.f.read(16)
        if len(hdr) < 16:
            return None
        sec,usec,caplen,wirelen = struct.unpack(self.endian+"IIII", hdr)
        s = self.f.read(caplen)[:MTU]
        return s,(sec,usec,wirelen) # caplen = len(s)
项目:scapy-vxlan    作者:p4lang    | 项目源码 | 文件源码
def recv(self, size=MTU):
        """ Emulate a socket
        """
        return self.read_packet(size)[0]
项目:scapy-vxlan    作者:p4lang    | 项目源码 | 文件源码
def recv(self, size=MTU):
        return self.read_packet(size)