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

Method do_dissect_payload

scapy/layers/tls/record.py:569–595  ·  view source on GitHub ↗

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.

(self, s)

Source from the content-addressed store, hash-verified

567 return s
568
569 def do_dissect_payload(self, s):
570 """
571 Try to dissect the following data as a TLS message.
572 Note that overloading .guess_payload_class() would not be enough,
573 as the TLS session to be used would get lost.
574 """
575 if s:
576 # Check minimum length
577 if len(s) < 5:
578 p = conf.raw_layer(s, _internal=1, _underlayer=self)
579 self.add_payload(p)
580 return
581 msglen = struct.unpack('!H', s[3:5])[0] + 5
582 if len(s) < msglen:
583 # This is a fragment
584 self.add_payload(conf.padding_layer(s))
585 return
586 try:
587 p = TLS(s, _internal=1, _underlayer=self,
588 tls_session=self.tls_session)
589 except KeyboardInterrupt:
590 raise
591 except Exception:
592 if conf.debug_dissector:
593 raise
594 p = conf.raw_layer(s, _internal=1, _underlayer=self)
595 self.add_payload(p)
596
597 # Building methods
598

Callers 1

Calls 2

TLSClass · 0.85
add_payloadMethod · 0.45

Tested by

no test coverage detected