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

Class _TLSPadField

scapy/layers/tls/basefields.py:184–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183
184class _TLSPadField(StrField):
185 def i2len(self, pkt, i):
186 if i is not None:
187 return len(i)
188 return 0
189
190 def i2m(self, pkt, x):
191 if x is None:
192 return b""
193 return x
194
195 def addfield(self, pkt, s, val):
196 # We add nothing here. This is done in .post_build() if needed.
197 return s
198
199 def getfield(self, pkt, s):
200 if pkt.tls_session.consider_read_padding():
201 # This should work with SSLv3 and also TLS versions.
202 # Note that we need to retrieve pkt.padlen beforehand,
203 # because it's possible that the padding is followed by some data
204 # from another TLS record (hence the last byte from s would not be
205 # the last byte from the current record padding).
206 tmp_len = orb(s[pkt.padlen - 1])
207 return s[tmp_len:], self.m2i(pkt, s[:tmp_len])
208 return s, None
209
210 def i2repr(self, pkt, x):
211 # XXX Provide status when dissection has been performed successfully?
212 return repr(self.i2m(pkt, x))
213
214
215class _TLSPadLenField(ByteField):

Callers 1

TLSClass · 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…