scapy.layers.tls.handshake
TLS handshake fields & logic.
This module covers the handshake TLS subprotocol, except for the key exchange mechanisms which are addressed with keyexchange.py.
- class scapy.layers.tls.handshake.SupDataEntry(_pkt, /, *, sdtype=None, len=None, data=b'')[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SDTYPE | LEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. SupDataEntrySupDataEntry fields sdtype
Nonelen
Nonedata
b''
- class scapy.layers.tls.handshake.SupDataEntryUM(_pkt, /, *, sdtype=None, len=None, dlen=None, data=[])[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SDTYPE | LEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DLEN | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. SupDataEntryUMSupDataEntryUM fields sdtype
Nonelen
Nonedlen
Nonedata
[]
- class scapy.layers.tls.handshake.TLS13Certificate(_pkt, /, *, msgtype=11, msglen=None, cert_req_ctxt_len=None, cert_req_ctxt=b'', certslen=None, certs=[])[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |CERT REQ CTXT L| CERT REQ CTXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CERTSLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CERTS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13CertificateTLS13Certificate fields msgtype
11msglen
Nonecert_req_ctxt_len
Nonecert_req_ctxt
b''certslen
_ASN1CertLenFieldNonecerts
_ASN1CertAndExtListField[]
- class scapy.layers.tls.handshake.TLS13CertificateRequest(_pkt, /, *, msgtype=13, msglen=None, cert_req_ctxt_len=None, cert_req_ctxt=b'', extlen=None, ext=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |CERT REQ CTXT L| CERT REQ CTXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EXTLEN | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13CertificateRequestTLS13CertificateRequest fields msgtype
13msglen
Nonecert_req_ctxt_len
Nonecert_req_ctxt
b''extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLS13ClientHello(_pkt, /, *, msgtype=1, msglen=None, version=None, random_bytes=None, sidlen=None, sid=b'', cipherslen=None, ciphers=None, complen=None, comp=[0], extlen=None, ext=None)[源代码]
基类:
_TLSHandshakeTLS 1.3 ClientHello, with abilities to handle extensions.
The Random structure is 32 random bytes without any GMT time
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VERSION | RANDOM BYTES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | SIDLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SID | CIPHERSLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CIPHERS | COMPLEN | COMP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | EXTLEN | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLS13ClientHelloTLS13ClientHello fields msgtype
1msglen
Noneversion
_TLSClientVersionFieldNonerandom_bytes
_TLSRandomBytesFieldNonesidlen
Nonesid
_SessionIDFieldb''cipherslen
Noneciphers
_CipherSuitesFieldNonecomplen
Nonecomp
_CompressionMethodsField[0]extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLS13EndOfEarlyData(_pkt, /, *, msgtype=5, msglen=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLS13EndOfEarlyDataTLS13EndOfEarlyData fields msgtype
5msglen
None
- class scapy.layers.tls.handshake.TLS13HelloRetryRequest(_pkt, /, *, msgtype=2, msglen=None, version=771, random_bytes=None, sidlen=None, sid=b'', cipher=None, comp=[0], extlen=None, ext=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VERSION | RANDOM BYTES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | SIDLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SID | CIPHER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | COMP | EXTLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13HelloRetryRequestTLS13HelloRetryRequest fields msgtype
2msglen
Noneversion
_TLSVersionField771random_bytes
_TLSRandomBytesFieldNonesidlen
Nonesid
_SessionIDFieldb''cipher
Nonecomp
_CompressionMethodsField[0]extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLS13KeyUpdate(_pkt, /, *, msgtype=24, msglen=None, request_update=0)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | REQUEST UPDATE| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13KeyUpdateTLS13KeyUpdate fields msgtype
24msglen
Nonerequest_update
0
- class scapy.layers.tls.handshake.TLS13NewSessionTicket(_pkt, /, *, msgtype=4, msglen=None, ticket_lifetime=4294967295, ticket_age_add=0, noncelen=None, ticket_nonce=b'', ticketlen=None, ticket=b'', extlen=None, ext=None)[源代码]
基类:
_TLSHandshakeUncomment the TicketField line for parsing a RFC 5077 ticket.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | TICKET LIFETIME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | TICKET AGE ADD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | NONCELEN | TICKET NONCE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TICKETLEN | TICKET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EXTLEN | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13NewSessionTicketTLS13NewSessionTicket fields msgtype
4msglen
Noneticket_lifetime
4294967295ticket_age_add
0noncelen
Noneticket_nonce
b''ticketlen
Noneticket
b''extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLS13ServerHello(_pkt, /, *, msgtype=2, msglen=None, version=771, random_bytes=None, sidlen=None, sid=b'', cipher=None, comp=[0], extlen=None, ext=None)[源代码]
-
TLS 1.3 ServerHello
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VERSION | RANDOM BYTES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | SIDLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SID | CIPHER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | COMP | EXTLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLS13ServerHelloTLS13ServerHello fields msgtype
2msglen
Noneversion
_TLSVersionField771random_bytes
_TLSRandomBytesFieldNonesidlen
Nonesid
_SessionIDFieldb''cipher
Nonecomp
_CompressionMethodsField[0]extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLSCertificate(_pkt, /, *, msgtype=11, msglen=None, certslen=None, certs=[])[源代码]
基类:
_TLSHandshakeXXX We do not support RFC 5081, i.e. OpenPGP certificates.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | CERTSLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | CERTS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSCertificateTLSCertificate fields msgtype
11msglen
Nonecertslen
_ASN1CertLenFieldNonecerts
_ASN1CertListField[]
- class scapy.layers.tls.handshake.TLSCertificateRequest(_pkt, /, *, msgtype=13, msglen=None, ctypeslen=None, ctypes=[1, 64], sig_algs_len=None, sig_algs=[1027, 1025, 513], certauthlen=None, certauth=[])[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | CTYPESLEN | CTYPES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIG ALGS LEN | SIG ALGS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CERTAUTHLEN | CERTAUTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSCertificateRequestTLSCertificateRequest fields msgtype
13msglen
Nonectypeslen
Nonectypes
_CertTypesField[1, 64]sig_algs_len
Nonesig_algs
[1027, 1025, 513]certauthlen
Nonecertauth
_CertAuthoritiesField[]
- class scapy.layers.tls.handshake.TLSCertificateStatus(_pkt, /, *, msgtype=22, msglen=None, status_type=1, responselen=None, response=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | STATUS TYPE | RESPONSELEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | RESPONSE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSCertificateStatusTLSCertificateStatus fields msgtype
22msglen
Nonestatus_type
1responselen
Noneresponse
_StatusFieldNone
- class scapy.layers.tls.handshake.TLSCertificateURL(_pkt, /, *, msgtype=21, msglen=None, certchaintype=None, uahlen=None, uah=[])[源代码]
基类:
_TLSHandshakeDefined in RFC 4366. PkiPath structure of section 8 is not implemented yet.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | CERTCHAINTYPE | UAHLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | UAH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSCertificateURLTLSCertificateURL fields msgtype
21msglen
Nonecertchaintype
Noneuahlen
Noneuah
[]
- class scapy.layers.tls.handshake.TLSCertificateVerify(_pkt, /, *, msgtype=15, msglen=None, sig=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SIG | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSCertificateVerifyTLSCertificateVerify fields msgtype
15msglen
Nonesig
_TLSSignatureFieldNone
- class scapy.layers.tls.handshake.TLSClientHello(_pkt, /, *, msgtype=1, msglen=None, version=None, gmt_unix_time=None, random_bytes=None, sidlen=None, sid=b'', cipherslen=None, ciphers=None, complen=None, comp=[0], extlen=None, ext=None)[源代码]
基类:
_TLSHandshakeTLS ClientHello, with abilities to handle extensions.
The Random structure follows the RFC 5246: while it is 32-byte long, many implementations use the first 4 bytes as a gmt_unix_time, and then the remaining 28 byts should be completely random. This was designed in order to (sort of) mitigate broken RNGs. If you prefer to show the full 32 random bytes without any GMT time, just comment in/out the lines below.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VERSION | GMT UNIX TIME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | RANDOM BYTES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | SIDLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SID | CIPHERSLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CIPHERS | COMPLEN | COMP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | EXTLEN | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSClientHelloTLSClientHello fields msgtype
1msglen
Noneversion
_TLSClientVersionFieldNonegmt_unix_time
_GMTUnixTimeFieldNonerandom_bytes
_TLSRandomBytesFieldNonesidlen
Nonesid
_SessionIDFieldb''cipherslen
Noneciphers
_CipherSuitesFieldNonecomplen
Nonecomp
_CompressionMethodsField[0]extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLSClientKeyExchange(_pkt, /, *, msgtype=16, msglen=None, exchkeys=None)[源代码]
基类:
_TLSHandshakeThis class mostly works like TLSServerKeyExchange and its 'params' field.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | EXCHKEYS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSClientKeyExchangeTLSClientKeyExchange fields msgtype
16msglen
Noneexchkeys
_TLSCKExchKeysFieldNone
- class scapy.layers.tls.handshake.TLSEncryptedExtensions(_pkt, /, *, msgtype=8, msglen=None, extlen=None, ext=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | EXTLEN | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSEncryptedExtensionsTLSEncryptedExtensions fields msgtype
8msglen
Noneextlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- class scapy.layers.tls.handshake.TLSFinished(_pkt, /, *, msgtype=20, msglen=None, vdata=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VDATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSFinishedTLSFinished fields msgtype
20msglen
Nonevdata
_VerifyDataFieldNone
- class scapy.layers.tls.handshake.TLSHelloRequest(_pkt, /, *, msgtype=0, msglen=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSHelloRequestTLSHelloRequest fields msgtype
0msglen
None
- class scapy.layers.tls.handshake.TLSHelloVerifyRequest(_pkt, /, *, msgtype=21, msglen=None, cookielen=None, cookie=b'')[源代码]
基类:
_TLSHandshakeDefined for DTLS, see RFC 6347.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | COOKIELEN | COOKIE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSHelloVerifyRequestTLSHelloVerifyRequest fields msgtype
21msglen
Nonecookielen
Nonecookie
b''
- class scapy.layers.tls.handshake.TLSNewSessionTicket(_pkt, /, *, msgtype=4, msglen=None, lifetime=4294967295, ticketlen=None, ticket=b'')[源代码]
基类:
_TLSHandshakeXXX When knowing the right secret, we should be able to read the ticket.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | LIFETIME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | TICKETLEN | TICKET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSNewSessionTicketTLSNewSessionTicket fields msgtype
4msglen
Nonelifetime
4294967295ticketlen
Noneticket
b''
- class scapy.layers.tls.handshake.TLSServerHello(_pkt, /, *, msgtype=2, msglen=None, version=None, gmt_unix_time=None, random_bytes=None, sidlen=None, sid=b'', cipher=None, comp=[0], extlen=None, ext=None)[源代码]
基类:
_TLSHandshakeTLS ServerHello, with abilities to handle extensions.
The Random structure follows the RFC 5246: while it is 32-byte long, many implementations use the first 4 bytes as a gmt_unix_time, and then the remaining 28 byts should be completely random. This was designed in order to (sort of) mitigate broken RNGs. If you prefer to show the full 32 random bytes without any GMT time, just comment in/out the lines below.
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | VERSION | GMT UNIX TIME | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | RANDOM BYTES | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | SIDLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SID | CIPHER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | COMP | EXTLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EXT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSServerHelloTLSServerHello fields msgtype
2msglen
Noneversion
_TLSVersionFieldNonegmt_unix_time
_GMTUnixTimeFieldNonerandom_bytes
_TLSRandomBytesFieldNonesidlen
Nonesid
_SessionIDFieldb''cipher
Nonecomp
_CompressionMethodsField[0]extlen
_ExtensionsLenFieldNoneext
_ExtensionsFieldNone
- tls_session_update(msg_str)[源代码]
Either for parsing or building, we store the server_random along with the raw string representing this handshake message. We also store the session_id, the cipher suite (if recognized), the compression method, and finally we instantiate the pending write and read connection states. Usually they get updated later on in the negotiation when we learn the session keys, and eventually they are committed once a ChangeCipherSpec has been sent/received.
- class scapy.layers.tls.handshake.TLSServerHelloDone(_pkt, /, *, msgtype=14, msglen=None)[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSServerHelloDoneTLSServerHelloDone fields msgtype
14msglen
None
- class scapy.layers.tls.handshake.TLSServerKeyExchange(_pkt, /, *, msgtype=12, msglen=None, params=None, sig=None)[源代码]
基类:
_TLSHandshake- aliastypes
- build(*args, **kargs)[源代码]
We overload build() method in order to provide a valid default value for params based on TLS session if not provided. This cannot be done by overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built according to key_exchange.server_kx_msg_cls which should have been set after receiving a cipher suite in a previous ServerHello. Usual cases are:
None: for RSA encryption or fixed FF/ECDH. This should never happen, as no ServerKeyExchange should be generated in the first place.
ServerDHParams: for ephemeral FFDH. In that case, the parameter to server_kx_msg_cls does not matter.
ServerECDH*Params: for ephemeral ECDH. There are actually three classes, which are dispatched by _tls_server_ecdh_cls_guess on the first byte retrieved. The default here is b"03", which corresponds to ServerECDHNamedCurveParams (implicit curves).
When the Server*DHParams are built via .fill_missing(), the session server_kx_privkey will be updated accordingly.
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | PARAMS | SIG | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. TLSServerKeyExchangeTLSServerKeyExchange fields msgtype
12msglen
Noneparams
_TLSServerParamsFieldNonesig
_TLSSignatureFieldNone
- class scapy.layers.tls.handshake.TLSSupplementalData(_pkt, /, *, msgtype=23, msglen=None, sdatalen=None, sdata=[])[源代码]
基类:
_TLSHandshake- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MSGTYPE | MSGLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SDATALEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SDATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TLSSupplementalDataTLSSupplementalData fields msgtype
23msglen
Nonesdatalen
Nonesdata
[]
- class scapy.layers.tls.handshake.ThreeBytesLenField(name, default, length_of=None, adjust=<function ThreeBytesLenField.<lambda>>)[源代码]
- class scapy.layers.tls.handshake.URLAndOptionalHash(_pkt, /, *, urllen=None, url=b'', hash_present=None, hash=b'')[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | URLLEN | URL | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HASH PRESENT | HASH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. URLAndOptionalHashURLAndOptionalHash fields urllen
Noneurl
b''hash_present
Nonehash
b''
- class scapy.layers.tls.handshake.UserMappingData(_pkt, /, *, version=None, len=None, data=b'')[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VERSION | LEN | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. UserMappingDataUserMappingData fields version
Nonelen
Nonedata
b''