Unisys Stealth

This integration is intended to aid companies in integrating with the Stealth EcoAPI service. Using the included commands, security teams can trigger dynamically isolation of users or endpoints from the rest of the Stealth network.

Endpoint · Unisys Stealth

Details

IDUnisys Stealth
ProviderUnisys Corporation
CategoryEndpoint
From Version6.0.0
Docker Imagedemisto/python3:3.12.8.3296088
Supported ModulesAgentix XSIAM

README

This integration is intended to aid companies in integrating with the Stealth EcoAPI service. Using the included commands, security teams can trigger dynamically isolation of users or endpoints from the rest of the Stealth network.

Configure Unisys Stealth in Cortex

Parameter Required
Stealth Eco API IP Address or Hostname True
Stealth Eco API Port True
Credentials True
Isolation Role ID False
Trust any certificate (unsecure) False
Use Proxy? 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.

stealth-isolate-machine


This is the command which will isolate an endpoint from the Stealth Network

Base Command

stealth-isolate-machine

Input

Argument Name Description Required
endpoint FQDN of machine to isolate. Required

Context Output

There is no context output for this command.

stealth-unisolate-machine


This is the command which will un-isolate an endpoint from Stealth Network

Base Command

stealth-unisolate-machine

Input

Argument Name Description Required
endpoint FQDN of machine to isolate. Required

Context Output

There is no context output for this command.

stealth-get-stealth-roles


Retrieve roles from Stealth Network

Base Command

stealth-get-stealth-roles

Input

There are no input arguments for this command.

Context Output

There is no context output for this command.

stealth-isolate-user


This is the command which will isolate an user from the Stealth Network

Base Command

stealth-isolate-user

Input

Argument Name Description Required
user Hostname of machine to isolate. Optional

Context Output

There is no context output for this command.

stealth-unisolate-user


This is the command which will un-isolate an user from Stealth Network

Base Command

stealth-unisolate-user

Input

Argument Name Description Required
user Username to un-isolate. Optional

Context Output

There is no context output for this command.

stealth-isolate-machine-and-user


This is the command which will isolate an endpoint and user from the Stealth Network

Base Command

stealth-isolate-machine-and-user

Input

Argument Name Description Required
endpoint FQDN of machine to isolate. Optional
user Username to isolate. Optional

Context Output

There is no context output for this command.

stealth-unisolate-machine-and-user


This is the command which will un-isolate an endpoint and user from Stealth Network

Base Command

stealth-unisolate-machine-and-user

Input

Argument Name Description Required
endpoint FQDN of machine to isolate. Optional
user Username to un-isolate. Optional

Context Output

There is no context output for this command.

Configuration parameters

  • server_ip — Stealth Eco API IP Address or Hostname (required)
  • port — Stealth Eco API Port (required)
  • credentials — Credentials (required)
  • isolation_id — Isolation Role ID
  • trust — Trust any certificate (unsecure)
  • proxy — Use system proxy settings

Commands (7)

  • stealth-get-stealth-roles

    Retrieve roles from Stealth Network

  • stealth-isolate-machine

    This is the command which will isolate an endpoint from the Stealth Network

  • stealth-isolate-machine-and-user

    This is the command which will isolate an endpoint and user from the Stealth Network

  • stealth-isolate-user

    This is the command which will isolate an user from the Stealth Network

  • stealth-unisolate-machine

    This is the command which will un-isolate an endpoint from Stealth Network

  • stealth-unisolate-machine-and-user

    This is the command which will un-isolate an endpoint and user from Stealth Network

  • stealth-unisolate-user

    This is the command which will un-isolate an user from Stealth Network

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
import json
import os

import requests
from requests.auth import HTTPBasicAuth
import urllib3

# disable insecure warnings
urllib3.disable_warnings()

USERNAME = demisto.params().get("credentials")["identifier"]
PASSWORD = demisto.params().get("credentials")["password"]
SERVER_IP = demisto.params().get("server_ip")
PORT = demisto.params().get("port")
ISOLATION_ID = demisto.params()["isolation_id"]
BASE_URL = f"https://{SERVER_IP}:{PORT}/uisStealth/EcoApi/v1"
HEADERS = {
    "Accept": "application/json",
    "Content-Type": "application/json",
}
VERIFY = demisto.params().get("insecure", False)
if not demisto.params().get("proxy", False):
    os.environ.pop("HTTP_PROXY", "")
    os.environ.pop("HTTPS_PROXY", "")
    os.environ.pop("http_proxy", "")
    os.environ.pop("https_proxy", "")
proxy = demisto.params().get("proxy", False)


def http_request(method, uri, data=None, **kwargs):
    try:
        requests.Request()
        res = requests.request(
            method=method,
            url=f"{BASE_URL}{uri}",
            verify=VERIFY,
            data=data,
            headers=HEADERS,
            auth=HTTPBasicAuth(USERNAME, PASSWORD),
            **kwargs,
        )
    except requests.exceptions.Timeout:
        raise DemistoException("HTTP Request to Stealth has timed out. Please try again")
    except requests.exceptions.TooManyRedirects:
        raise DemistoException("Invalid API Endpoint")

    if res.status_code not in {200, 204}:
        raise DemistoException(f"Error received {res.status_code} in API response")

    # May need to change this to .content
    return res


def test_module():
    data = http_request(
        method="GET",
        uri="/role",
    )
    return data


def get_roles():
    data = http_request(
        method="GET",
        uri="/role",
    )
    return data.json()


def isolate_machine(endpoint):
    payload = {"role": [{"id": ISOLATION_ID, "endpoint": [{"name": endpoint}]}]}
    data = http_request(
        "PUT",
        uri="/role/isolate",
        data=json.dumps(payload),
    )
    return data


def unisolate_machine(endpoint):
    data = http_request(method="DELETE", uri=f"/role/isolate?hostname={endpoint}")
    return data


def isolate_user(user):
    payload = {"role": [{"id": ISOLATION_ID, "accounts": {"user": [{"name": user}]}}]}
    data = http_request(
        "PUT",
        "/role/isolate",
        data=json.dumps(payload),
    )
    return data


def unisolate_user(user):
    url_string = f"/role/isolate?username={user}"
    data = http_request(
        method="DELETE",
        uri=url_string,
    )
    return data


def isolate_machine_and_user(endpoint, user):
    payload = {"role": [{"id": ISOLATION_ID, "accounts": {"user": [{"name": user}]}, "endpoint": [{"name": endpoint}]}]}
    data = http_request(method="PUT", uri="/role/isolate", data=json.dumps(payload))
    return data


def unisolate_machine_and_user(endpoint, user):
    data = http_request(method="DELETE", uri=f"/role/isolate?username={user}&hostname={endpoint}")
    return data


if demisto.command() == "test-module":
    result = test_module()
    demisto.results("ok")
elif demisto.command() == "stealth-get-stealth-roles":
    result = get_roles()
    rows = [{"Name": role["name"], "ID": role["id"]} for role in result["role"]]
    table = tableToMarkdown("Stealth Roles", rows)
    return_outputs(readable_output=table, outputs={"Stealth": result}, raw_response=result)
elif demisto.command() == "stealth-isolate-machine":
    endpoint = demisto.args()["endpoint"]
    result = isolate_machine(endpoint)
    return_outputs(readable_output=f"{endpoint} successfully isolated", outputs={"Stealth": {"isolate": endpoint}})
    demisto.results(result)
elif demisto.command() == "stealth-unisolate-machine":
    endpoint = demisto.args()["endpoint"]
    result = unisolate_machine(endpoint)
    return_outputs(readable_output=f"{endpoint} successfully unisolated", outputs={"Stealth": {"unisolate": endpoint}})
elif demisto.command() == "stealth-isolate-user":
    user = demisto.args()["user"]
    result = isolate_user(user)
    return_outputs(readable_output=f"{user} successfully isolated", outputs={"Stealth": {"isolate": user}})
elif demisto.command() == "stealth-unisolate-user":
    user = demisto.args()["user"]
    result = unisolate_user(user)
    return_outputs(readable_output=f"{user} successfully unisolated", outputs={"Stealth": {"unisolate": user}})
elif demisto.command() == "stealth-isolate-machine-and-user":
    endpoint = demisto.args()["endpoint"]
    user = demisto.args()["user"]
    result = isolate_machine_and_user(endpoint, user)
    return_outputs(
        readable_output=f"{endpoint} and {user} successfully isolated", outputs={"Stealth": {"isolate": [endpoint, user]}}
    )
elif demisto.command() == "stealth-unisolate-machine-and-user":
    endpoint = demisto.args()["endpoint"]
    user = demisto.args()["user"]
    result = unisolate_machine_and_user(endpoint, user)
    return_outputs(
        readable_output=f"{endpoint} and {user} successfully unisolated", outputs={"Stealth": {"unisolate": [endpoint, user]}}
    )
else:
    demisto.results("Enter valid command")