Exemple #1
0
    def run(self, task):
        matches = []
        for sign in BaseSignature.__subclasses__():
            try:
                sign = sign()
                # Casting results to dict to avoid auto key creation.
                match = sign.check(self.data)
            except KeyError:
                continue
            except Exception as e:
                print e
                continue

            if match:
                foo = {
                    "id": sign.pk,
                    "name": sign.name,
                    "category": sign.category,
                    "severity": sign.severity,
                    "description": sign.description
                }
                if isinstance(match, tuple):
                    foo["data"] = match
                matches.append(foo)

        self.results["signatures"] = matches

        return self.results
Exemple #2
0
    def run(self, task):
        matches = []
        for sign in BaseSignature.__subclasses__():
            try:
                sign = sign()
                # Casting results to dict to avoid auto key creation.
                # NOTE: deepcopy is used to run signatures on a copy to avoid creation
                # of empty Autovivification dict keys.
                match = sign.check(deepcopy(self.data))
            except KeyError:
                continue
            except Exception as e:
                print e
                continue

            if match:
                foo = {
                       "id": sign.pk,
                       "name": sign.name,
                       "category": sign.category,
                       "severity": sign.severity,
                       "description": sign.description
                       }
                if isinstance(match, tuple):
                    foo["data"] = match
                matches.append(foo)

        self.results["signatures"] = matches

        return self.results
Exemple #3
0
    def run(self, task):
        matches = []
        for sign in BaseSignature.__subclasses__():
            try:
                sign = sign()
                # Casting results to dict to avoid auto key creation.
                # NOTE: deepcopy is used to run signatures on a copy to avoid creation
                # of empty Autovivification dict keys.
                match = sign.check(deepcopy(self.data))
            except KeyError:
                continue
            except Exception as e:
                print(e)
                continue

            if match:
                foo = {
                       "id": sign.pk,
                       "name": sign.name,
                       "category": sign.category,
                       "severity": sign.severity,
                       "description": sign.description
                       }
                if isinstance(match, tuple):
                    foo["data"] = match
                matches.append(foo)

        self.results["signatures"] = matches

        return self.results