def _get_path_values(self, path): klass = prelude.IDMEFClass(path) if klass.getValueType() == prelude.IDMEFValue.TYPE_ENUM: return klass.getEnumValues() else: return None
def _format_classification(self, finfo, root, obj): return resource.HTMLNode( "ul", self._format_value( root.get("alert.classification"), prelude.IDMEFClass("alert.classification.text"), label=False, tooltip=root.get("alert.assessment.impact.description")))
def get_childs(self, obj): i = 0 cl = prelude.IDMEFClass(obj.getId()) while True: try: child = cl.get(i) except Exception: break i += 1 yield child
def format(self, finfo, root, obj): if finfo.path in self._objects: return self._objects[finfo.path](finfo, root, obj) try: cl = prelude.IDMEFClass(finfo.path) if cl.getValueType() == prelude.IDMEFValue.TYPE_CLASS: return self._format_object(root, obj, cl) except Exception: pass return datasearch.Formatter.format(self, finfo, root, obj)
def _get_path_values(self, path): klass = prelude.IDMEFClass(path) if path == "alert.assessment.impact.severity": return [ PathValue("high", label=N_("High"), color=renderer.RED_STD), PathValue("medium", label=N_("Medium"), color=renderer.ORANGE_STD), PathValue("low", label=N_("Low"), color=renderer.GREEN_STD), PathValue("info", label=N_("Informational"), color=renderer.BLUE_STD), ] elif klass.getValueType() == prelude.IDMEFValue.TYPE_ENUM: return [PathValue(v) for v in klass.getEnumValues()] else: return None
def get_path_type(self, path): _typemap = { prelude.IDMEFValue.TYPE_DATA: bytes, prelude.IDMEFValue.TYPE_STRING: text_type, prelude.IDMEFValue.TYPE_TIME: datetime.datetime, prelude.IDMEFValue.TYPE_FLOAT: float, prelude.IDMEFValue.TYPE_DOUBLE: float, prelude.IDMEFValue.TYPE_ENUM: text_type, prelude.IDMEFValue.TYPE_INT8: int, prelude.IDMEFValue.TYPE_UINT8: int, prelude.IDMEFValue.TYPE_INT16: int, prelude.IDMEFValue.TYPE_UINT16: int, prelude.IDMEFValue.TYPE_INT32: int, prelude.IDMEFValue.TYPE_UINT32: int, prelude.IDMEFValue.TYPE_INT64: int, prelude.IDMEFValue.TYPE_UINT64: int, prelude.IDMEFValue.TYPE_CLASS: object, } return _typemap[prelude.IDMEFClass(path).getValueType()]
def get_paths(self): return self._get_paths(prelude.IDMEFClass("heartbeat"))
def get_paths(self): return self._get_paths(prelude.IDMEFClass("alert"))
def get_path_type(self, path): return prelude.IDMEFClass(path).getValueType()