import json

def export_iocs_json(result: dict, outfile: str):
    index = result["index"]

    iocs = {
        "ips": index["ips"],
        "domains": index["dns"],
        "ports": list(index["ports"].keys()),
        "services": list(index["services"].keys()),
        "credentials": index["credentials"],
    }

    with open(outfile, "w") as f:
        json.dump(iocs, f, indent=2)
