Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 from CommonServerUserPython import * def main(domains: str, urls: str) -> CommandResults: """Checks that the urls are in the domain in the domain name. Args: domains: A comma separated list of domains. urls: A comma separated list of urls. Returns: Results to display in CortexXSOAR """ urls = argToList(urls) domains = set(argToList(domains)) outputs: list[dict] = [] for url in urls: results = demisto.executeCommand("ExtractDomainFromUrlAndEmail", {"input": url.lower()}) if is_error(results): demisto.debug(f"Could not get domain from url {url}") return_error(get_error(results)) else: domain_from_url = results[0]["Contents"] outputs.append( { "URL": url, "Domain": domain_from_url, "IsInternal": (domain_from_url in domains) or url.startswith(("https://localhost", "http://localhost")), } ) return CommandResults("IsUrlPartOfDomain", outputs=outputs) if __name__ in ("builtins", "__builtin__"): return_results(main(**demisto.args()))
README
Checks if the supplied URLs are in the specified domains.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Cortex XSOAR Version | 5.0.0 |
Used In
This script is used in the following playbooks and scripts.
- PCAP Parsing And Indicator Enrichment
Inputs
| Argument Name | Description |
|---|---|
| domains | A comma-separated list of domains. |
| urls | A comma-separated list of URLs. |
Outputs
| Path | Description | Type |
|---|---|---|
| IsUrlPartOfDomain.URL | The path of the URLs. | String |
| IsUrlPartOfDomain.Domain | The domain checked with the URL. | String |
| IsUrlPartOfDomain.IsInternal | Whether the URL is in the domain. | Boolean |