import traceback
import demistomock as demisto
from CommonServerPython import *
def get_html_representation(entity: str, potentially_isolated: str) -> str:
if not entity:
html = "
No IP Address associated with the ChronicleAsset
"
else:
html = f"{entity}
IP Address Not Blocked
"
if potentially_isolated == "Yes":
html = f"{entity}
IP Address Potentially Blocked
"
return html
def main() -> None:
try:
indicator_custom_fields = demisto.args().get("indicator").get("CustomFields", {})
entity = indicator_custom_fields.get("chronicleassetip", "")
potentially_isolated = indicator_custom_fields.get("chroniclepotentiallyblockedip", "No")
html = get_html_representation(entity, potentially_isolated)
demisto.results({"Type": 1, "ContentsFormat": formats["html"], "Contents": html})
except Exception as e:
demisto.error(traceback.format_exc())
return_error(f"Could not load widget:\n{e}")
# python2 uses __builtin__ python3 uses builtins
if __name__ == "__builtin__" or __name__ == "builtins":
main()