def __str__(self): return ( "%s(%sB): class: %s type: %s " "length: %sB checksum: %s timestamp: %s" % (self.NAME, self.LEN, SCMPClass.to_str(self.class_), scmp_type_name(self.class_, self.type), self.total_len, hex_str(self._checksum), iso_timestamp(self.timestamp / 1000000)))
def _get_scmp_handler(self, pkt): scmp = pkt.l4_hdr try: type_map = self.SCMP_PLD_CLASS_MAP[scmp.class_] except KeyError: logging.error("SCMP class not supported: %s(%s)\n%s", scmp.class_, SCMPClass.to_str(scmp.class_), pkt) return None try: return type_map[scmp.type] except KeyError: logging.error("SCMP %s type not supported: %s(%s)\n%s", scmp.type, scmp.class_, scmp_type_name(scmp.class_, scmp.type), pkt) return None