Unit42IntelObjectsFeed Deprecated

Deprecated. Use the Unit 42 Feed instead.

Data Enrichment & Threat Intelligence · Unit 42 Intel (Deprecated) · Feed

Details

IDUnit42IntelObjectsFeed
ProviderPalo Alto Networks
CategoryData Enrichment & Threat Intelligence
From Version6.5.0
Docker Imagedemisto/python3:3.12.8.3296088
Supported ModulesAgentix XSIAM

README

Configure Unit 42 Intel Objects Feed on Cortex XSOAR

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for Unit 42 Intel Objects Feed.
  3. Click Add instance to create and configure a new integration instance.

    Parameter Description Required
    API Key Account’s private token. False
    Unit 42 Intel Endpoint URL The Unit 42 Intel endpoint URL. False
    Fetch indicators   False
    Indicator Reputation Indicators from this integration instance will be marked with this reputation. False
    Source Reliability Reliability of the source providing the intelligence data. True
    Traffic Light Protocol Color The Traffic Light Protocol (TLP) designation to apply to indicators fetched from the feed. False
    Feed Fetch Interval The feed fetch interval. False
    Bypass exclusion list When selected, the exclusion list is ignored for indicators from this feed. This means that if an indicator from this feed is on the exclusion list, the indicator might still be added to the system. False
    Create Relationships Create relationships between indicators as part of Enrichment. False
    Trust any certificate (not secure) Whether to trust any certificate (not secure). False
    Use system proxy settings   False
    Tags Supports CSV values. False
  4. Click Test to validate the URLs, token, and connection.

Commands

You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

unit42intel-objects-feed-get-indicators


Gets indicators from the feed.

Base Command

unit42intel-objects-feed-get-indicators

Input

Argument Name Description Required
limit The maximum number of results to return. Should be 50 or less. Default is 10. Optional

Context Output

There is no context output for this command.

Command Example

!unit42intel-objects-feed-get-indicators limit=10

Human Readable Output

Value Type Fields
DarkHotel Threat Actor publications: {‘link’: ‘https://securelist.com/the-darkhotel-apt/66779/’, ‘title’: ‘The DarkHotel APT’, ‘source’: ‘Kaspersky’, ‘timestamp’: ‘2018-08-20T15:25:31’},aliases: ParasiticBeast, description: The DarkHotel attackers were most infamously behind a series of attacks between 2008 and 2014 against organizations located primarily in Japan, Taiwan, China, Russia and South Korea. This campaign infiltrated multiple hotel networks and used them as a jumping-off point to infect hotel guests., lastseenbysource: 2021-05-03T01:55:18Z, updateddate: 2019-08-28T08:56:30Z ,reportedby: Unit 42

Notes

Be aware, due to API limitations, fetch-indicators fetches only a limited number of indicators for each interval.
Fetching all the indicators can take up to 13 hours.

Configuration parameters

  • url — Unit 42 Intel Endpoint URL (required)
  • api_key
  • feed — Fetch indicators
  • feedIncremental — Incremental Feed
  • feedReputation — Indicator Reputation
  • feedReliability — Source Reliability (required)
  • tlp_color — Traffic Light Protocol Color
  • feedFetchInterval — Feed Fetch Interval
  • feedBypassExclusionList — Bypass exclusion list
  • feedExpirationPolicy
  • feedExpirationInterval
  • feedTags — Tags
  • create_relationships — Create relationships
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (1)

  • unit42intel-objects-feed-get-indicators

    Gets indicators from the feed.

import json

import pytest
from FeedUnit42IntelObjects import Client, fetch_indicators_command, incremental_level_fetch


def util_load_json(path):
    with open(path, encoding="utf-8") as f:
        return json.loads(f.read())


def test_build_iterator(mocker):
    """
    Given:
        - Output of the feed API
    When:
        - When calling fetch_indicators or get_indicators
    Then:
        - Returns a list of the indicators parsed from the API's response
    """

    client = Client(api_key="1234", base_url="url", verify=False, proxy=False)
    mocker.patch.object(client, "get_tags", return_value=util_load_json("test_data/all_tags_result.json"))
    mocker.patch.object(client, "get_tag_details", return_value={"tag": []})
    indicators = client.build_iterator(is_get_command=True)
    assert len(indicators) == 2


def test_fetch_indicators(mocker):
    """
    Given:
        - Output of the feed API as list
    When:
        - Fetching indicators from the API
    Then:
        - Create indicator objects list
    """

    client = Client(api_key="1234", base_url="url", verify=False, proxy=False)
    mocker.patch.object(client, "build_iterator", return_value=util_load_json("test_data/build_iterator_results.json"))
    actual_results = fetch_indicators_command(client, params={"tlp_color": "RED"})[0]
    expected_results = util_load_json("test_data/fetch_indicators_results.json")[0]
    assert actual_results["type"] == expected_results["type"]
    assert actual_results["value"] == expected_results["value"]
    assert actual_results["fields"] == expected_results["fields"]


def test_incremental_level_fetch(mocker):
    context = {"tags_need_to_be_fetched": [], "time_of_first_fetch": 133033333}
    client = Client(api_key="1234", base_url="url", verify=False, proxy=False)
    mocker.patch("FeedUnit42IntelObjects.get_integration_context", return_value=context)
    mocker.patch(
        "FeedUnit42IntelObjects.get_all_updated_tags_since_last_fetch", return_value=[{"publictag_name": "Mock.mocktag1"}]
    )  # noqa: E501
    mocker.patch.object(client, "get_tag_details", return_value=util_load_json("test_data/tag_details_result.json"))
    actual_result = incremental_level_fetch(client)
    assert actual_result == [util_load_json("test_data/tag_details_result.json")]


def test_user_secrets():
    from FeedUnit42IntelObjects import LOG, Client

    client = Client(api_key="%%This_is_API_key%%", base_url="url", verify=False, proxy=False)
    res = LOG(client.headers)
    assert "%%This_is_API_key%%" not in res


def test_validate_created_time_from_refs():
    from FeedUnit42IntelObjects import validate_created_time_from_refs

    tags = util_load_json("test_data/build_iterator_results.json")
    for tag in tags:
        refs = json.loads(tag.get("tag", {}).get("refs", ""))[0]
        created = refs.get("created", "")
        res = validate_created_time_from_refs(created)
        assert res == f"{created}Z"


@pytest.mark.parametrize(
    "created, expected_result",
    [
        ("2016--08-10T14:27:05", "2016-08-10T14:27:05Z"),
        ("2016", "2016-01-01T00:00:00Z"),
        ("1-1", "1970-01-01T00:00:00Z"),
        ("Test wrong format", ""),
    ],
)
def test_validate_created_time_from_refs_incorrect_format(created, expected_result):
    from FeedUnit42IntelObjects import validate_created_time_from_refs

    res = validate_created_time_from_refs(created)
    assert res == expected_result