예제 #1
0
    def _get_path_values(self, path):
        klass = prelude.IDMEFClass(path)

        if klass.getValueType() == prelude.IDMEFValue.TYPE_ENUM:
            return klass.getEnumValues()
        else:
            return None
예제 #2
0
 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")))
예제 #3
0
    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
예제 #4
0
    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)
예제 #5
0
    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
예제 #6
0
    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()]
예제 #7
0
파일: idmef.py 프로젝트: gustavi/prewikka
 def get_paths(self):
     return self._get_paths(prelude.IDMEFClass("heartbeat"))
예제 #8
0
파일: idmef.py 프로젝트: gustavi/prewikka
 def get_paths(self):
     return self._get_paths(prelude.IDMEFClass("alert"))
예제 #9
0
파일: idmef.py 프로젝트: gustavi/prewikka
 def get_path_type(self, path):
     return prelude.IDMEFClass(path).getValueType()