示例#1
0
 def __init__(self, max_length=MAX_DOT15D4_LENGTH - 11):
     #TODO: Check max value being used
     self.max_frame_len = max_length
     self.fields_desc = [
         StrFixedLenField("load", "", length_from=self.get_load_length)
     ]
     Packet.__init__(self)
示例#2
0
 def __init__(self, *args, **fields):
     try:
         self.tls_ctx = fields["ctx"]
         del(fields["ctx"])
     except KeyError:
         self.tls_ctx = None
     Packet.__init__(self, *args, **fields)
示例#3
0
    def __init__(self,
                 _pkt="",
                 post_transform=None,
                 _internal=0,
                 _underlayer=None,
                 tls_session=None,
                 **fields):
        try:
            setme = self.tls_session is None
        except Exception:
            setme = True

        if setme:
            if tls_session is None:
                self.tls_session = tlsSession()
            else:
                self.tls_session = tls_session

        self.rcs_snap_init = self.tls_session.rcs.snapshot()
        self.wcs_snap_init = self.tls_session.wcs.snapshot()

        Packet.__init__(self,
                        _pkt=_pkt,
                        post_transform=post_transform,
                        _internal=_internal,
                        _underlayer=_underlayer,
                        **fields)
示例#4
0
 def __init__(self, *args, **fields):
     try:
         self.tls_ctx = fields["ctx"]
         del(fields["ctx"])
     except KeyError:
         self.tls_ctx = None
     Packet.__init__(self, *args, **fields)
示例#5
0
 def __init__(self, *args, **kwargs):
     # type: (Any, Any) -> None
     self.tx_id = kwargs.pop("tx_id", None)  # type: Optional[int]
     self.rx_id = kwargs.pop("rx_id", None)  # type: Optional[int]
     self.ext_address = kwargs.pop("ext_address", None)  # type: Optional[int]  # noqa: E501
     self.rx_ext_address = kwargs.pop("rx_ext_address", None)  # type: Optional[int]  # noqa: E501
     Packet.__init__(self, *args, **kwargs)
     self.validate_fields()
示例#6
0
    def __init__(self,
                 _pkt="",
                 post_transform=None,
                 _internal=0,
                 _underlayer=None,
                 tls_session=None,
                 **fields):
        try:
            setme = self.tls_session is None
        except Exception:
            setme = True

        newses = False
        if setme:
            if tls_session is None:
                newses = True
                self.tls_session = tlsSession()
            else:
                self.tls_session = tls_session

        self.rcs_snap_init = self.tls_session.rcs.snapshot()
        self.wcs_snap_init = self.tls_session.wcs.snapshot()

        if isinstance(_underlayer, TCP):
            tcp = _underlayer
            self.tls_session.sport = tcp.sport
            self.tls_session.dport = tcp.dport
            try:
                self.tls_session.ipsrc = tcp.underlayer.src
                self.tls_session.ipdst = tcp.underlayer.dst
            except AttributeError:
                pass
            if conf.tls_session_enable:
                if newses:
                    s = conf.tls_sessions.find(self.tls_session)
                    if s:
                        if s.dport == self.tls_session.dport:
                            self.tls_session = s
                        else:
                            self.tls_session = s.mirror()
                    else:
                        conf.tls_sessions.add(self.tls_session)
            if self.tls_session.connection_end == "server":
                srk = conf.tls_sessions.server_rsa_key
                if not self.tls_session.server_rsa_key and \
                        srk:
                    self.tls_session.server_rsa_key = srk

        Packet.__init__(self,
                        _pkt=_pkt,
                        post_transform=post_transform,
                        _internal=_internal,
                        _underlayer=_underlayer,
                        **fields)
示例#7
0
 def __init__(self, *args, **fields):
     try:
         self.tls_ctx = fields["ctx"]
         del (fields["ctx"])
         self.above_tls10 = self.tls_ctx.params.negotiated.version > TLSVersion.TLS_1_0
         if self.explicit_iv_field not in self.fields_desc and self.above_tls10:
             self.fields_desc.append(self.explicit_iv_field)
         for field in self.decryptable_fields:
             if field not in self.fields_desc:
                 self.fields_desc.append(field)
     except KeyError:
         self.tls_ctx = None
     Packet.__init__(self, *args, **fields)
示例#8
0
 def __init__(self, *args, **fields):
     try:
         self.tls_ctx = fields["ctx"]
         del(fields["ctx"])
         self.above_tls10 = self.tls_ctx.params.negotiated.version > TLSVersion.TLS_1_0
         if self.explicit_iv_field not in self.fields_desc and self.above_tls10:
             self.fields_desc.append(self.explicit_iv_field)
         for field in self.decryptable_fields:
             if field not in self.fields_desc:
                 self.fields_desc.append(field)
     except KeyError:
         self.tls_ctx = None
     Packet.__init__(self, *args, **fields)
示例#9
0
 def __init__(self,
              pkt=b"",
              mtype=None,
              method=None,
              seqid=None,
              args=None,
              header=None):
     Packet.__init__(self, pkt)
     self.setfieldval('type', mtype)
     self.setfieldval('method', method)
     self.setfieldval('seqid', seqid)
     self.setfieldval('header', header)
     self.setfieldval('args', args)
     self.setfieldval('load', pkt)
     if args and not isinstance(args, ThriftStruct):
         raise ValueError('args must be a ThriftStruct instance')
     if header and not isinstance(header, ThriftStruct):
         raise ValueError('header must be a ThriftStruct instance')
示例#10
0
文件: session.py 项目: mcpat/scapy
    def __init__(self, _pkt="", post_transform=None, _internal=0,
                 _underlayer=None, tls_session=None, **fields):
        try:
            setme = self.tls_session is None
        except:
            setme = True

        if setme:
            if tls_session is None:
                self.tls_session = tlsSession()
            else:
                self.tls_session = tls_session

        self.rcs_snap_init = self.tls_session.rcs.snapshot()
        self.wcs_snap_init = self.tls_session.wcs.snapshot()

        Packet.__init__(self, _pkt=_pkt, post_transform=post_transform,
                        _internal=_internal, _underlayer=_underlayer,
                        **fields)
示例#11
0
 def __init__(self, *args, **kwargs):
     self.src = None
     self.dst = None
     self.exsrc = None
     self.exdst = None
     if "src" in kwargs:
         self.src = kwargs["src"]
         del kwargs["src"]
     if "dst" in kwargs:
         self.dst = kwargs["dst"]
         del kwargs["dst"]
     if "exsrc" in kwargs:
         self.exsrc = kwargs["exsrc"]
         del kwargs["exsrc"]
     if "exdst" in kwargs:
         self.exdst = kwargs["exdst"]
         del kwargs["exdst"]
     Packet.__init__(self, *args, **kwargs)
     self.validate_fields()
示例#12
0
    def __init__(self,
                 _pkt="",
                 post_transform=None,
                 _internal=0,
                 _underlayer=None,
                 tls_session=None,
                 **fields):
        try:
            setme = self.tls_session is None
        except:
            setme = True

        if setme:
            if tls_session is None:
                self.tls_session = tlsSession()
            else:
                self.tls_session = tls_session

        Packet.__init__(self,
                        _pkt=_pkt,
                        post_transform=post_transform,
                        _internal=_internal,
                        _underlayer=_underlayer,
                        **fields)
示例#13
0
 def __init__(self, _pkt=None, _orig_s=None, _orig_p=None, *args, **kwargs):
     self._orig_s = _orig_s
     self._orig_p = _orig_p
     Packet.__init__(self, _pkt=_pkt, *args, **kwargs)
 def __init__(self, _pkt=None, index=0, **kwargs):
     self._restart_indentation(index)
     Packet.__init__(self, _pkt, **kwargs)
 def __init__(self, _pkt=None, offset=0, pkt_len=0, **kwargs):
     self.my_offset = offset
     self.pkt_len = pkt_len
     Packet.__init__(self, _pkt, **kwargs)
示例#16
0
文件: dns.py 项目: netkey/scapy
 def __init__(self, _pkt=None, _orig_s=None, _orig_p=None, *args, **kwargs):
     self._orig_s = _orig_s
     self._orig_p = _orig_p
     Packet.__init__(self, _pkt=_pkt, *args, **kwargs)
示例#17
0
文件: ccp.py 项目: ucifs/scapy
 def __init__(self, *args, **kwargs):
     self.payload_cls = DEFAULT_DTO
     if "payload_cls" in kwargs:
         self.payload_cls = kwargs["payload_cls"]
         del kwargs["payload_cls"]
     Packet.__init__(self, *args, **kwargs)
示例#18
0
 def __init__(self, *args, **kwargs):
     Packet.__init__(self, *args, **kwargs)
     self.explicit = 1
示例#19
0
文件: netflow.py 项目: commial/scapy
 def __init__(self, *args, **kwargs):
     Packet.__init__(self, *args, **kwargs)
     if self.fieldType is not None and not self.fieldLength and self.fieldType in NetflowV9TemplateFieldDefaultLengths:  # noqa: E501
         self.fieldLength = NetflowV9TemplateFieldDefaultLengths[self.fieldType]  # noqa: E501
示例#20
0
 def __init__(self, *args, **kwargs):
     Packet.__init__(self, *args, **kwargs)
     if self.fieldType is not None and not self.fieldLength and self.fieldType in NetflowV9TemplateFieldDefaultLengths:  # noqa: E501
         self.fieldLength = NetflowV9TemplateFieldDefaultLengths[
             self.fieldType]  # noqa: E501
示例#21
0
文件: dot11.py 项目: netkey/scapy
 def __init__(self, _pkt=None, index=0, **kwargs):
     self._restart_indentation(index)
     Packet.__init__(self, _pkt, **kwargs)