BechtleDarkWebScan

Notifies you if login credentials to your company are being sold on the dark web.

Identity and Access Management · Bechtle Dark Web Scan

Details

IDBechtleDarkWebScan
ProviderBechtle
CategoryIdentity and Access Management
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.12042988

README

The dark web scan integration notifies you if login credentials to your company are being sold on the dark web.

Configure BechtleDarkWebScan in Cortex

Parameter Description Required
API Key Your darkwebscan.app API Key True
Additional request headers Additional request headers False
Fetch incidents Whether to fetch incidents False
Incidents Fetch Interval The interval incidents should be fetched False
First fetch time The first fetch time False
Incident type The incident type False
Maximum incidents per fetch Maxmimum amount of incidents per fetch False
Trust any certificate (not secure) Whether to trust any certificate False
Use system proxy settings Whether to use system proxy settings False

Commands

You can execute these commands from the 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.

darkwebscan-getcompanies


Returns a list of all companies associated with your API key.

Base Command

darkwebscan-getcompanies

Input

There are no input arguments for this command.

Context Output

Path Type Description
BechtleDarkWebScan.Companies String All companies that you have access to.

darkwebscan-getleaks


Returns leaked credentials for a given company_id.

Base Command

darkwebscan-getleaks

Input

Argument Name Description Required
company_id ID of the company to retrieve leaked credentials for. Required
only_new Only return leaks not previously seen by this integration instance. Possible values are: true, false. Default is false. Optional

Context Output

Path Type Description
BechtleDarkWebScan.LeakedCredentials String Leaked credentials for a given company_id.

darkwebscan-getosint


Returns OSINT information about the associated domain of a given company_id.

Base Command

darkwebscan-getosint

Input

Argument Name Description Required
company_id ID of the company to retrieve OSINT information for. Required

Context Output

Path Type Description
BechtleDarkWebScan.OSINT String OSINT information (email addresses, subdomains, …) for the associated domain of a given company_id.

darkwebscan-getemailsecurity


Returns information about the email security for the associated domain of a given company_id.

Base Command

darkwebscan-getemailsecurity

Input

Argument Name Description Required
company_id ID of the company to retrieve email security information for. Required

Context Output

Path Type Description
BechtleDarkWebScan.EmailSecurity String Email security (SPF, DMARC, DANE, …) for the associated domain of a given company_id.

darkwebscan-getwaf


Returns Web Application Firewall Status information about the associated domain of a given company_id.

Base Command

darkwebscan-getwaf

Input

Argument Name Description Required
company_id ID of the company to retrieve Web Application Firewall Status information for. Required

Context Output

Path Type Description
BechtleDarkWebScan.WAF String Web Application Firewall status and product name (if applicable)

darkwebscan-resetcontext


Resets integration context for the DarkWebScan. May result in many alerts reappearing.

Base Command

darkwebscan-resetcontext

Input

There are no input arguments for this command.

Context Output

Path Type Description
BechtleDarkWebScan.ResetContext String Returns text whether the reset was successful or not.

Configuration parameters

  • apikey — API Key (required)
  • addreqheaders — Additional request headers
  • isFetch — Fetch incidents
  • incidentFetchInterval — Incidents Fetch Interval
  • first_fetch — First fetch time
  • incidentType — Incident type
  • max_fetch — Maximum incidents per fetch
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (6)

  • darkwebscan-getcompanies

    Returns a list of all companies associated with your API key.

  • darkwebscan-getemailsecurity

    Returns information about the email security for the associated domain of a given company_id.

  • darkwebscan-getleaks

    Returns leaked credentials for a given company_id.

  • darkwebscan-getosint

    Returns OSINT information about the associated domain of a given company_id.

  • darkwebscan-getwaf

    Returns Web Application Firewall Status information about the associated domain of a given company_id.

  • darkwebscan-resetcontext

    Resets integration context for the DarkWebScan. May result in many alerts reappearing.

"""BechtleDarkWebScan Integration for Cortex XSOAR - Unit Tests file

Pytest Unit Tests: all function names must start with "test_"

More details: https://xsoar.pan.dev/docs/integrations/unit-testing
"""

from test_data.constants import *
from BechtleDarkWebScan import (
    Client,
    darkwebscan_getcompanies_command,
    darkwebscan_getleaks_command,
    darkwebscan_resetcontext_command,
    darkwebscan_getemailsecurity_command,
    darkwebscan_getosint_command,
    darkwebscan_getwaf_command,
)
import json


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


def test_command_darkwebscan_getcompanies(requests_mock):
    """Tests darkwebscan-getcompanies command function.

    Checks the output of the command function with the expected output.
    """
    mock_api_response = MOCK_GET_COMPANIES_RESPONSE

    mock_url = MOCK_BASE_URL + "/user/companies"
    requests_mock.get(mock_url, json=mock_api_response)

    client = Client(base_url=MOCK_BASE_URL, verify=False, proxy=False, api_key="dummyapikey", additional_request_headers={})

    response = darkwebscan_getcompanies_command(client, {})

    assert response.outputs_prefix == "BechtleDarkWebScan.Companies"
    assert response.outputs == MOCK_GET_COMPANIES_RESPONSE
    assert "Test Company" in response.readable_output


def test_command_darkwebscan_getleaks(requests_mock):
    """Tests darkwebscan-getleaks command function.

    Checks the output of the command function with the expected output.
    """
    mock_api_response = MOCK_GET_LEAKS_RESPONSE

    mock_url = MOCK_BASE_URL + "/user/lookout/my-leaked-data"
    requests_mock.get(mock_url, json=mock_api_response)

    client = Client(base_url=MOCK_BASE_URL, verify=False, proxy=False, api_key="dummyapikey", additional_request_headers={})

    response = darkwebscan_getleaks_command(client, {"company_id": 123, "only_new": "false"})

    assert response.outputs_prefix == "BechtleDarkWebScan.LeakedCredentials"
    assert response.outputs == MOCK_GET_LEAKS_RESPONSE.get("searchResults")
    assert "john.doe@example.org" in response.readable_output


def test_command_darkwebscan_getemailsecurity(requests_mock):
    """Tests darkwebscan-getemailsecurity command function.

    Checks the output of the command function with the expected output.
    """
    mock_api_response = MOCK_GET_EMAILSECURITY_RESPONSE

    mock_url = MOCK_BASE_URL + "/scan/email-security"
    requests_mock.get(mock_url, json=mock_api_response)

    client = Client(base_url=MOCK_BASE_URL, verify=False, proxy=False, api_key="dummyapikey", additional_request_headers={})

    response = darkwebscan_getemailsecurity_command(client, {"company_id": 123})

    spf = MOCK_GET_EMAILSECURITY_RESPONSE.get("spf")
    dmarc = MOCK_GET_EMAILSECURITY_RESPONSE.get("dmarc")
    dane = MOCK_GET_EMAILSECURITY_RESPONSE.get("dane")
    expected_output = {
        "SPF": {"Record": spf.get("spfRecord"), "Info": spf.get("warning"), "Summary": spf.get("summary")},
        "DMARC": {"Record": dmarc.get("dmarcRecord"), "Info": dmarc.get("warning"), "Summary": dmarc.get("summary")},
        "DANE": {"EmailHosts": dane.get("emailHosts"), "Info": dane.get("warning"), "Summary": dane.get("summary")},
    }

    assert response.outputs_prefix == "BechtleDarkWebScan.EmailSecurity"
    assert response.outputs == expected_output
    assert "policy" in response.readable_output


def test_command_darkwebscan_resetcontext():
    """Tests darkwebscan-resetcontext command function.

    Checks the output of the command function with the expected output.

    No mock is needed here because the say_hello_command does not call
    any external API.
    """
    response = darkwebscan_resetcontext_command()

    assert response.readable_output == MOCK_RESETCONTEXT_RESPONSE


def test_command_darkwebscan_getwaf(requests_mock):
    """Tests darkwebscan-getwaf command function.

    Checks the output of the command function with the expected output.
    """
    mock_api_response = MOCK_GET_WAF_RESPONSE

    mock_url = MOCK_BASE_URL + "/scan/waf"
    requests_mock.get(mock_url, json=mock_api_response)

    client = Client(base_url=MOCK_BASE_URL, verify=False, proxy=False, api_key="dummyapikey", additional_request_headers={})

    response = darkwebscan_getwaf_command(client, {"company_id": 123})

    assert response.outputs_prefix == "BechtleDarkWebScan.WAF"
    assert response.outputs == MOCK_GET_WAF_RESPONSE
    assert "is in use" in response.readable_output


def test_command_darkwebscan_getosint(requests_mock):
    """Tests darkwebscan-getosint command function.

    Checks the output of the command function with the expected output.
    """
    mock_api_response = MOCK_GET_OSINT_RESPONSE

    mock_url = MOCK_BASE_URL + "/scan/osint"
    requests_mock.get(mock_url, json=mock_api_response)

    client = Client(base_url=MOCK_BASE_URL, verify=False, proxy=False, api_key="dummyapikey", additional_request_headers={})

    response = darkwebscan_getosint_command(client, {"company_id": 123})

    assert response.outputs_prefix == "BechtleDarkWebScan.OSINT"
    assert response.outputs == MOCK_GET_OSINT_RESPONSE
    assert "rbrk01" in response.readable_output