Details
| ID | IsUrlPartOfDomain |
|---|---|
| Language | python |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.13.10404775 |
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 |
import demistomock as demisto def test_main_localhost_https(mocker): """ Scenario: Make sure localhost https url is recognized as internal url Given: - URL contains https://localhost When: - Running the script Then: - Return localhost url with internal=true """ from IsUrlPartOfDomain import main url = "https://localhost:443" mocker.patch.object(demisto, "executeCommand", return_value=[{"Contents": "", "Type": "ok"}]) mocker.patch.object(demisto, "results") results = main(urls=url, domains="") assert results.outputs[0].get("URL") == url assert results.outputs[0].get("IsInternal") is True def test_main_localhost_http(mocker): """ Scenario: Make sure localhost http url is recognized as internal url Given: - URL contains http://localhost When: - Running the script Then: - Return localhost url with internal=true """ from IsUrlPartOfDomain import main url = "http://localhost:8080" mocker.patch.object(demisto, "executeCommand", return_value=[{"Contents": "", "Type": "ok"}]) mocker.patch.object(demisto, "results") results = main(urls=url, domains="") assert results.outputs[0].get("URL") == url assert results.outputs[0].get("IsInternal") is True