Perform the dissection of the layer's payload :param str s: the raw layer
(self, s)
| 1057 | return s |
| 1058 | |
| 1059 | def do_dissect_payload(self, s): |
| 1060 | # type: (bytes) -> None |
| 1061 | """ |
| 1062 | Perform the dissection of the layer's payload |
| 1063 | |
| 1064 | :param str s: the raw layer |
| 1065 | """ |
| 1066 | if s: |
| 1067 | if ( |
| 1068 | self.stop_dissection_after and |
| 1069 | isinstance(self, self.stop_dissection_after) |
| 1070 | ): |
| 1071 | # stop dissection here |
| 1072 | p = conf.raw_layer(s, _internal=1, _underlayer=self) |
| 1073 | self.add_payload(p) |
| 1074 | return |
| 1075 | cls = self.guess_payload_class(s) |
| 1076 | try: |
| 1077 | p = cls( |
| 1078 | s, |
| 1079 | stop_dissection_after=self.stop_dissection_after, |
| 1080 | _internal=1, |
| 1081 | _underlayer=self, |
| 1082 | ) |
| 1083 | except KeyboardInterrupt: |
| 1084 | raise |
| 1085 | except Exception: |
| 1086 | if conf.debug_dissector: |
| 1087 | if issubtype(cls, Packet): |
| 1088 | log_runtime.error("%s dissector failed", cls.__name__) |
| 1089 | else: |
| 1090 | log_runtime.error("%s.guess_payload_class() returned " |
| 1091 | "[%s]", |
| 1092 | self.__class__.__name__, repr(cls)) |
| 1093 | if cls is not None: |
| 1094 | raise |
| 1095 | p = conf.raw_layer(s, _internal=1, _underlayer=self) |
| 1096 | self.add_payload(p) |
| 1097 | |
| 1098 | def dissect(self, s): |
| 1099 | # type: (bytes) -> None |
no test coverage detected