url-enrichment
Enriches URL indicators with reputation data from multiple integrations and outputs a consolidated URLEnrichment object. This script exclusively supports indicators of type URL and will automatically create the indicator in TIM if it is not already exists.
python · Aggregated Scripts
Details
| ID | url-enrichment |
|---|---|
| Language | python |
| From Version | 8.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Tags | basescript |
README
Enriches URL indicators with reputation data from multiple integrations and outputs a consolidated URLEnrichment object. This script exclusively supports indicators of type URL and will automatically create the indicator in TIM if it is not already exists.
Note: This script is supported in Cortex XSOAR 8.0 and later, and in Cortex XSIAM.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | basescript |
| Cortex XSOAR Version | 8.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| url_list | Accepts a list of URLs to enrich. - From CLI: Provide a comma-separated list. If a URL contains a comma, wrap the URLs in a JSON array. Example: “[\“https://example.com/search?tags=red,yellow,green\”, \“https://example2.com\”]”. - From Context: Pass JSON arrays directly, without modification. |
| external_enrichment | Whether to call external integrations for enrichment: - ‘true’: enrich using enabled external integrations (e.g., VirusTotal (API v3), AlienVault OTX v2). - ‘false’: use only existing TIM data; skip external integrations. If the ‘brands’ argument is provided, this flag is ignored and enrichment is run only on the brands provided. |
| verbose | Retrieve a human-readable entry for each command; if false, only the final result is summarized and errors are suppressed. |
| brands | A list of integration brands to run enrichment against. Example: `“VirusTotal (API v3), AlienVault OTX v2”`. - If provided, only the selected brands are used. - If left empty, the script runs enrichment on all enabled integrations, depending on the `external_enrichment` flag. To see the available brands for the `url` command, run: `!ProvidesCommand command=url`. |
| additional_fields | When set to true, the output includes an `AdditionalFields` object for each of the indicator result. `AdditionalFields` contains all fields returned by TIM or the integrations that are not part of the standard output keys: `Data`, `DetectionEngines`, `PositiveDetections`, `Score`, and `Brand`. When set to false, only the standard keys are returned. |
Outputs
| Path | Description | Type |
|---|---|---|
| URLEnrichment.Value | The URL. | string |
| URLEnrichment.MaxScore | The max score of all the indicators found. | number |
| URLEnrichment.MaxVerdict | The max verdict of all the indicators found. | string |
| URLEnrichment.Results | List of all indicators found for the URL. | array |
| URLEnrichment.TIMScore | The TIM score of the URL. | number |
| URLEnrichment.Status | The status of the indicator: “Manual” if the score was changed manually, “Fresh” if modified within the last week, “Stale” if modified more than a week ago, and “None” if never modified. | string |
| URLEnrichment.ModifiedTime | The time the indicator was last modified. | Date |
| URLEnrichment.Results.Brand | The brand of the indicator. | string |
| URLEnrichment.Results.Score | The score of the indicator. | number |
| URLEnrichment.Results.Verdict | The verdict of the indicator. | string |
| URLEnrichment.Results.DetectionEngines | The detection engines of the indicator. | number |
| URLEnrichment.Results.PositiveDetections | The positive detections of the indicator. | number |
| URLEnrichment.Results.Data | The URL it self. | string |
| URLEnrichment.Results.AdditionalFields | All fields extracted from the indicator other then the main keys (“Brand”, “Score”, “Verdict”, “DetectionEngines”, “PositiveDetections”, “Data”). | Object |
| URLEnrichment.Results.AdditionalFields.Relationships.EntityA | The source of the relationship. | string |
| URLEnrichment.Results.AdditionalFields.Relationships.EntityB | The destination of the relationship. | string |
| URLEnrichment.Results.AdditionalFields.Relationships.Relationship | The name of the relationship. | string |
| URLEnrichment.Results.AdditionalFields.Relationships.EntityAType | The type of the source of the relationship. | string |
| URLEnrichment.Results.AdditionalFields.Relationships.EntityBType | The type of the destination of the relationship. | string |
| URLEnrichment.Results.AdditionalFields.Category | The category associated with the indicator. | String |
| URLEnrichment.Results.AdditionalFields.Malicious.Vendor | The vendor reporting the URL as malicious. | String |
| URLEnrichment.Results.AdditionalFields.Malicious.Description | A description of the malicious URL. | String |
| URLEnrichment.Results.AdditionalFields.Tags | (List) Tags of the URL. | Unknown |
| URLEnrichment.Results.AdditionalFields.FeedRelatedIndicators.value | Indicators that are associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.FeedRelatedIndicators.type | The type of the indicators that are associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.FeedRelatedIndicators.description | The description of the indicators that are associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.MalwareFamily | The malware family associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.Port | Ports that are associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.Internal | Whether or not the URL is internal or external. | Bool |
| URLEnrichment.Results.AdditionalFields.Campaign | The campaign associated with the URL. | String |
| URLEnrichment.Results.AdditionalFields.TrafficLightProtocol | The Traffic Light Protocol (TLP) color that is suitable for the URL. | String |
| URLEnrichment.Results.AdditionalFields.ThreatTypes.threatcategory | The threat category associated to this indicator by the source vendor. For example, Phishing, Control, TOR, etc. | String |
| URLEnrichment.Results.AdditionalFields.ThreatTypes.threatcategoryconfidence | Threat Category Confidence is the confidence level provided by the vendor for the threat type category For example a confidence of 90 for threat type category ‘malware’ means that the vendor rates that this is 90% confidence of being a malware. | String |
| URLEnrichment.Results.AdditionalFields.ASN | The autonomous system name for the URL, for example: ‘AS8948’. | String |
| URLEnrichment.Results.AdditionalFields.ASOwner | The autonomous system owner of the URL. | String |
| URLEnrichment.Results.AdditionalFields.GeoCountry | The country in which the URL is located. | String |
| URLEnrichment.Results.AdditionalFields.Organization | The organization of the URL. | String |
| URLEnrichment.Results.AdditionalFields.CommunityNotes.note | Notes on the URL that were given by the community. | String |
| URLEnrichment.Results.AdditionalFields.CommunityNotes.timestamp | The time in which the note was published. | Date |
| URLEnrichment.Results.AdditionalFields.Publications.source | The source in which the article was published. | String |
| URLEnrichment.Results.AdditionalFields.Publications.title | The name of the article. | String |
| URLEnrichment.Results.AdditionalFields.Publications.link | A link to the original article. | String |
| URLEnrichment.Results.AdditionalFields.Publications.timestamp | The time in which the article was published. | Date |
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * from AggregatedCommandApiModule import * def url_enrichment_script( url_list: list[str], external_enrichment: bool = False, verbose: bool = False, enrichment_brands: list[str] = [], additional_fields: bool = False, args: dict[str, Any] = {}, ) -> CommandResults: """ Enriches URL data with information from various integrations Args: url_list (list[str]): List of URLs to enrich. external_enrichment (bool): Whether to call external integrations for enrichment. verbose (bool): Whether to print verbose output. enrichment_brands (list[str]): List of brands to enrich with. additional_fields (bool): Whether to include additional fields in the output. Returns: CommandResult: The result of the command. """ demisto.debug("Extracting indicators") url_instances, extract_verbose = create_and_extract_indicators(url_list, "url") valid_inputs = [url_instance.extracted_value for url_instance in url_instances if url_instance.extracted_value] indicator_mapping = { "Data": "Data", "DetectionEngines": "DetectionEngines", "PositiveDetections": "PositiveDetections", "Score": "Score", "Brand": "Brand", } url_indicator_schema = IndicatorSchema( type="url", value_field="Data", context_path_prefix="URL(", # add ( to prefix to distinct from URLhaus integration context path context_output_mapping=indicator_mapping, ) # --- Command Batch 1: create indicators (BUILTIN) --- demisto.debug("Creating commands - Batch 1: Creating new indicators") command_batch1: list[Command] = [ Command( name="CreateNewIndicatorsOnly", args={"indicator_values": valid_inputs, "type": "URL"}, command_type=CommandType.BUILTIN, context_output_mapping=None, ignore_using_brand=True, ) ] # --- Command Batch 2: external enrichment --- demisto.debug("Creating commands - Batch 2: Enriching indicators") command_batch2: list[Command] = [ Command( name="enrichIndicators", args={"indicatorsValues": valid_inputs}, command_type=CommandType.EXTERNAL, ) ] commands = [command_batch1, command_batch2] demisto.debug("Commands: ") for i, batch in enumerate(commands): demisto.debug(f"Batch {i}") for j, cmd in enumerate(batch): demisto.debug(f"Command {j}: {cmd}") url_reputation = ReputationAggregatedCommand( brands=enrichment_brands, verbose=verbose, commands=commands, additional_fields=additional_fields, external_enrichment=external_enrichment, final_context_path="URLEnrichment", args=args, indicator_instances=url_instances, indicator_schema=url_indicator_schema, verbose_outputs=[extract_verbose], ) return url_reputation.run() """ MAIN FUNCTION """ def main(): # pragma: no cover args = demisto.args() url_list = argToList(args.get("url_list")) external_enrichment = argToBoolean(args.get("external_enrichment", False)) verbose = argToBoolean(args.get("verbose", False)) brands = argToList(args.get("brands", [])) additional_fields = argToBoolean(args.get("additional_fields", False)) demisto.debug(f"Data list: {url_list}") demisto.debug(f"Brands: {brands}") try: return_results(url_enrichment_script(url_list, external_enrichment, verbose, brands, additional_fields, args)) except Exception as ex: return_error(f"Failed to execute !url-enrichment. Error: {str(ex)}") """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): # pragma: no cover main()