scapy.layers.tls.record_tls13

Common TLS 1.3 fields & bindings.

This module covers the record layer, along with the ChangeCipherSpec, Alert and ApplicationData submessages. For the Handshake type, see tls_handshake.py.

See the TLS class documentation for more information.

class scapy.layers.tls.record_tls13.TLS13(_pkt, /, *, type=23, version=771, len=None, inner=<TLSInnerPlaintext  |>, auth_tag=None)[source]

Bases: _GenericTLSSessionInheritance

aliastypes = [<class 'scapy.layers.tls.record_tls13.TLS13'>, <class 'scapy.layers.tls.session._GenericTLSSessionInheritance'>, <class 'scapy.packet.Packet'>]
deciphered_len
do_dissect_payload(s)[source]

Try to dissect the following data as a TLS message. Note that overloading .guess_payload_class() would not be enough, as the TLS session to be used would get lost.

fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<ByteEnumField (TLS13).type>, <_TLSVersionField (TLS13).version>, <_TLSLengthField (TLS13).len>, <_TLSInnerPlaintextField (TLS13).inner>, <_TLSMACField (TLS13).auth_tag>]
mysummary()[source]
post_build(pkt, pay)[source]

Apply the previous methods according to the writing cipher type.

post_dissect(s)[source]

Commit the pending read state if it has been triggered. We update nothing if the prcs was not set, as this probably means that we’re working out-of-context (and we need to keep the default rcs).

pre_dissect(s)[source]

Decrypt, verify and decompress the message.

class scapy.layers.tls.record_tls13.TLSInnerPlaintext(_pkt, /, *, msg=[], type=None, pad=b'')[source]

Bases: _GenericTLSSessionInheritance

aliastypes = [<class 'scapy.layers.tls.record_tls13.TLSInnerPlaintext'>, <class 'scapy.layers.tls.session._GenericTLSSessionInheritance'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<_TLSMsgListField (TLSInnerPlaintext).msg>, <ByteEnumField (TLSInnerPlaintext).type>, <XStrField (TLSInnerPlaintext).pad>]
pre_dissect(s)[source]

We need to parse the padding and type as soon as possible, else we won’t be able to parse the message list…