コード例 #1
0
ファイル: run.py プロジェクト: CERT-Polska/mwdb_iocextract
def main():
    parser = argparse.ArgumentParser(
        description="Test parser on the top mwdb configs")
    parser.add_argument("mwdb_user", help="Mwdb username")
    parser.add_argument("mwdb_pass", help="Mwdb password")
    parser.add_argument("config_id",
                        help="Config to parse",
                        default=None,
                        nargs="?")
    args = parser.parse_args()

    mwdb = Malwarecage()
    mwdb.login(args.mwdb_user, args.mwdb_pass)

    if args.config_id is not None:
        cfg = mwdb.query_config(args.config_id)
        iocs = parse(cfg.family, cfg.cfg)
        print(iocs.prettyprint())
        return

    for cfg in mwdb.recent_configs():
        if cfg.type != "static":
            continue
        print(cfg.id)
        iocs = parse(cfg.family, cfg.cfg)
        print(iocs.prettyprint())
        continue
コード例 #2
0
def main() -> None:
    parser = argparse.ArgumentParser(
        description="Downloading test data from MWDB"
    )
    parser.add_argument("mwdb_user", help="Mwdb username")
    parser.add_argument("mwdb_pass", help="Mwdb password")
    parser.add_argument(
        "mwdb_config_id", nargs="?", help="Config Id", default=""
    )
    args = parser.parse_args()

    current_path = os.path.abspath(os.path.dirname(__file__))
    testdir = current_path + "/testdata/"

    mwdb = Malwarecage()
    mwdb.login(args.mwdb_user, args.mwdb_pass)

    if args.mwdb_config_id:
        mwdb_config = mwdb.query_config(args.mwdb_config_id)

        json_file_name = (
            mwdb_config.family + "_" + args.mwdb_config_id + ".json"
        )
        generate_config_json_file(testdir, json_file_name, mwdb_config)
    else:
        families_parsed = set()
        for cfg in mwdb.recent_configs():
            if cfg.type != "static":
                continue

            if cfg.family not in families_parsed:
                json_file_name = cfg.family + "_" + cfg.id + ".json"
                generate_config_json_file(testdir, json_file_name, cfg)
                families_parsed.add(cfg.family)
コード例 #3
0
def main():
    parser = argparse.ArgumentParser(
        description="Test parser on the top mwdb configs")
    parser.add_argument("mwdb_user", help="Mwdb username")
    parser.add_argument("mwdb_pass", help="Mwdb password")
    args = parser.parse_args()

    mwdb = Malwarecage()
    mwdb.login(args.mwdb_user, args.mwdb_pass)

    for cfg in mwdb.recent_configs():
        if cfg.type != "static":
            continue
        print(cfg.id)
        iocs = parse(cfg.family, cfg.cfg)
        print(iocs.prettyprint())
        continue