CheckLastEnrichment

Check if DomainTools Data is in Need of Enrichment.

python · DomainTools Iris Investigate

Source

from typing import Any

from CommonServerPython import *


def time_check(last_check: str) -> bool:
    time_diff = datetime.now() - datetime.strptime(last_check, "%Y-%m-%d")
    return time_diff.days >= 1


def check_last_enrichment(args: dict[str, Any]) -> CommandResults:
    last_enrichment = args["last_enrichment"]

    should_refresh_enrichment = "yes" if last_enrichment is None or time_check(last_enrichment) else "no"

    return CommandResults(
        outputs_prefix="CheckLastEnrichment", outputs=should_refresh_enrichment, readable_output=should_refresh_enrichment
    )


def main():
    try:
        return_results(check_last_enrichment(demisto.args()))
    except Exception as ex:
        return_error(f"Failed to execute CheckLastEnrichment. Error: {ex!s}")


if __name__ in ["__main__", "__builtin__", "builtins"]:
    main()

README

Check if DomainTools Data is in Need of Enrichment

Script Data


Name Description
Script Type python3
Tags DomainTools, Condition
Cortex XSOAR Version 6.9.0

Inputs


Argument Name Description
last_enrichment Date domain was last enriched ‘%Y-%m-%d’

Outputs


Path Description Type
yes Refresh Enrichment Data String
no Don’t Refresh Enrichment Data String