Example #1
0
    def run(self, results):
        if HAVE_BINGRAPH and reporting_conf.bingraph.enabled:
            bingraph_path = os.path.join(self.analysis_path, "bingraph")
            if not os.path.exists(bingraph_path):
                os.makedirs(bingraph_path)
            try:
                if not os.listdir(bingraph_path):
                    bingraph_args_dict.update({
                        "prefix":
                        results["target"]["file"]["sha256"],
                        "files": [self.file_path],
                        "save_dir":
                        bingraph_path,
                    })
                    bingraph_gen(bingraph_args_dict)
            except Exception as e:
                log.info(e)

            for key in ("dropped", "procdump", "CAPE"):
                for block in results.get(key, []) or []:
                    if block.get("size", 0) != 0 and block.get("type", "").startswith("PE32") and \
                            not os.path.exists(os.path.join(bingraph_path, "{}-ent.svg".format(block["sha256"]))):
                        bingraph_args_dict.update({
                            "prefix": block["sha256"],
                            "files": [block["path"]],
                            "save_dir": bingraph_path,
                        })
                        bingraph_gen(bingraph_args_dict)
Example #2
0
    def run(self, results):
        if HAVE_BINGRAPH and reporting_conf.bingraph.enabled:
            bingraph_path = os.path.join(self.analysis_path, "bingraph")
            if not os.path.exists(bingraph_path):
                os.makedirs(bingraph_path)
            try:
                if not os.listdir(bingraph_path) and results.get(
                        "target", {}).get("file", {}).get("sha256", False):
                    bingraph_args_dict.update({
                        "prefix":
                        results["target"]["file"]["sha256"],
                        "files": [self.file_path],
                        "save_dir":
                        bingraph_path
                    })
                    try:
                        bingraph_gen(bingraph_args_dict)
                    except Exception as e:
                        log.warning(
                            "Can't generate bingraph for {}: {}".format(
                                self.file_path, e))
            except Exception as e:
                log.info(e)

            for key in ("dropped", "procdump", "CAPE"):
                for block in results.get(key, []) or []:
                    if (block.get("size", 0) != 0
                            and block.get("type", "") not in excluded_filetypes
                            and not os.path.exists(
                                os.path.join(
                                    bingraph_path, "{}-ent.svg".format(
                                        block["sha256"])))):
                        path = ""
                        if block.get("file", False):
                            path = block["file"]
                        elif block.get("path", False):
                            path = block["path"]
                        if not path:
                            continue
                        bingraph_args_dict.update({
                            "prefix": block["sha256"],
                            "files": [path],
                            "save_dir": bingraph_path,
                        })
                        try:
                            bingraph_gen(bingraph_args_dict)
                        except Exception as e:
                            log.warning(
                                "Can't generate report for {}: {}".format(
                                    path, e))