MCPcopy Create free account
hub / github.com/secdev/scapy / _TLSVersionField

Class _TLSVersionField

scapy/layers/tls/basefields.py:72–96  ·  view source on GitHub ↗

We use the tls_version if it has been defined, else the advertised version. Also, the legacy 0x0301 is used for TLS 1.3 packets.

Source from the content-addressed store, hash-verified

70
71
72class _TLSVersionField(ShortEnumField):
73 """
74 We use the tls_version if it has been defined, else the advertised version.
75 Also, the legacy 0x0301 is used for TLS 1.3 packets.
76 """
77
78 def i2h(self, pkt, x):
79 if x is None:
80 v = pkt.tls_session.tls_version
81 if v:
82 return _tls13_version_filter(v, 0x0301)
83 else:
84 adv_v = pkt.tls_session.advertised_tls_version
85 return _tls13_version_filter(adv_v, 0x0301)
86 return x
87
88 def i2m(self, pkt, x):
89 if x is None:
90 v = pkt.tls_session.tls_version
91 if v:
92 return _tls13_version_filter(v, 0x0301)
93 else:
94 adv_v = pkt.tls_session.advertised_tls_version
95 return _tls13_version_filter(adv_v, 0x0301)
96 return x
97
98
99class _TLSLengthField(ShortField):

Callers 6

TLSClass · 0.90
SSLv2ClientHelloClass · 0.90
SSLv2ServerHelloClass · 0.90
TLS13Class · 0.90
TLSServerHelloClass · 0.90
handshake.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…