Minerva Labs Anti-Evasion Platform
Minerva eliminates the endpoint security gap while empowering companies to embrace technology fearlessly.
Endpoint · Minerva Labs Anti-Evasion Platform
Details
| ID | Minerva Labs Anti-Evasion Platform |
|---|---|
| Provider | Rapid7 |
| Category | Endpoint |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.8.3296088 |
| Supported Modules | Agentix XSIAM |
README
Minerva’s Threat Prevention Platform is an agent based solution that protects servers and workstations from real-world threats that evade existing security controls, protecting both modern operating systems and embedded low-resources operating systems as well.
Minerva modular design enables customers and partners to use Minerva-provided solutions or customize their Minerva deployment to fit their existing defense architecture.
Using the Cortex XSOAR platform, enterprises and service providers can now have automated visibility into prevented anomalies across endpoints and servers in the network, while processing them using built-in playbooks.
Minerva Labs’ Endpoint Malware Vaccination enables incident response teams to immunize endpoints in seconds and neutralize attacks by simulating infection markers, rather than creating them, allowing Minerva to contain outbreaks without impacting performance. The combined interlock of Cortex XSOAR and Minerva offers orchestration of an instant deployment of malware vaccinations thus preventing outbreaks of known network worms, by simulating their infection markers and preventing the malicious code installation.
This integration was integrated and tested with version 3.0 of Minerva Labs Anti-Evasion Platform.
Use Cases
- Fetch events from Minerva platform into Cortex XSOAR Playground
- List, add and delete vaccination artifacts to Minerva platform
- List, add and delete exclusions in order to handle FPs
- Search for events according to criteria
- Search for endpoints according to criteria
Configure Minerva Labs Anti-Evasion Platform on Cortex XSOAR
-
Navigate to Settings > Integrations > Servers & Services.
-
Search for Minerva Labs Anti-Evasion Platform.
-
Click Add instance to create and configure a new integration instance.
- Name: a textual name for the integration instance.
- Minerva Management Console URL, for example: https://SERVER/OWL
- Username
- Trust any certificate (not secure)
- Fetch incidents
-
Click Test to validate the URLs, token, and connection.
Fetched Incidents Data
The integration imports events from Minerva Management Console as incidents in Cortex XSOAR.
As each incident represents malicious activity, it contains all the available information gathered by Minerva for further analysis.
To use Fetch Incidents, configure a new instance and select the ‘Fetch-incidents’ option in the instance settings.
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.
- Add exclusions: minerva-add-exclusion
- Add a vaccination: minerva-add-vaccine
- Search for processes: minerva-search-process
- Search for an endpoint: minerva-search-endpoint
- Get all groups: minerva-get-groups
- Get mutex vaccines: minerva-get-vaccines
- Delete a vaccine: minerva-delete-vaccine
- Get all exclusions: minerva-get-exclusions
- Delete an exclusion: minerva-delete-exclusion
- Move all events from Archive to New event state: minerva-unarchive-events
1. Add exclusions
Adds exclusions to Minerva Console.
Base Command
minerva-add-exclusion
Input
| Argument Name | Description | Required |
|---|---|---|
| data | Exclusion data. | Required |
| type | The exclusion type. | Required |
| appliedGroupsIds | A list of group IDs to which this exclusion applies. | Optional |
| description | A description of the exclusion. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Exclusion.Id | string | Exclusion ID. |
| Minerva.Exclusion.Type | string | Exclusion type. |
| Minerva.Exclusion.Data | string | Exclusion data. |
| Minerva.Exclusion.Description | string | A description of the exclusion. |
| Minerva.Exclusion.lastModifiedBy | string | The user that last modified this exclusion. |
| Minerva.Exclusion.lastModifiedOn | date | The date this exclusion was last modified. |
| Minerva.Exclusion.appliedGroupsIds | string | Group IDs to which this exclusion applies. |
Command Example
!minerva-add-exclusion type="hash" description="cmd.exe hash" data="d0ceb18272966ab62b8edff100e9b4a6a3cb5dc0f2a32b2b18721fea2d9c09a5" appliedGroupsIds="All Groups"
Human Readable Output
| Last Modified On | Description | Type | Applied Groups Ids | Last Modified By | Data | Id |
|---|---|---|---|---|---|---|
| 2019-04-04T08:43:51.9441116Z | cmd.exe hash | hash | All Groups | admin | d0ceb18272966ab62b8edff100e9b4a6a3cb5dc0f2a32b2b18721fea2d9c09a5 | 86238d3e-dc99-4f62-b580-92fc4deb0184 |
2. Add a vaccination
Adds a vaccination.
Base Command
minerva-add-vaccine
Input
| Argument Name | Description | Required |
|---|---|---|
| name | Name of the mutex. | Required |
| description | A description of the vaccination. | Optional |
| isMonitorOnly | Whether it is only monitored. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Vaccine.Name | string | Name of the mutex vaccination. |
| Minerva.Vaccine.Description | string | A description of the mutex vaccination. |
| Minerva.Vaccine.isMonitorOnly | boolean | Whether this mutex vaccination is only monitored. |
| Minerva.Vaccine.lastModifiedBy | string | The user that last modified this mutex vaccination. |
| Minerva.Vaccine.lastModifiedOn | date | The date this mutex vaccination was last modified. |
| Minerva.Vaccine.Id | string | Mutex vaccination ID. |
| Minerva.Vaccine.Type | string | Vaccine type, for example: Mutex. |
Command Example
!minerva-add-vaccine name="Local\SomeMaliciousMutex" description="Made up mutex name" isMonitorOnly=True
Human Readable Output
| Last Modified On | Is Monitor Only | Name | Last Modified By | Type | Id | Description |
|---|---|---|---|---|---|---|
| 2019-05-13T09:48:51.6194895Z | true | Local\SomeMaliciousMutex | admin | Mutex | 711db7ed-d4c9-459b-a4bd-e23c077d4acc | Made up mutex name |
3. Search for processes
Search processes with Minerva.
Base Command
minerva-search-process
Input
| Argument Name | Description | Required |
|---|---|---|
| param | Parameter to search for. | Required |
| condition | A condition to apply to the search (“equalTo”, “notEqualTo”, “contain”,“notContain”, “startWith”, “endWith”). | Required |
| value | Value. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Process.Endpoint | string | The name of the endpoint on which the process was run. |
| Minerva.Process.SHA256 | string | The SHA256 hash of the process. |
| Minerva.Process.CommandLine | string | The process command line. |
| Minerva.Process.Username | string | The user name with which the process was executed. |
| Minerva.Process.Createtime | date | The time the process was created. |
| Minerva.Process.Pid | number | The process ID. |
| Minerva.Process.Name | string | The process name. |
Command Example
!minerva-search-process param="processName" condition="endWith" value="explorer.exe"
Human Readable Output
| Username | Process Id | Endpoint | File Hash | Process Command Line | Process Name | Depth | Start Time | Id |
|---|---|---|---|---|---|---|---|---|
| DaniK@MVDEV | 21736 | danik.MVDev.local | cef64201a97e08834f5c8952907a1719531a7d99b53309cb2e2956f40cff3486 | C:\WINDOWS\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding | C:\Windows\explorer.exe | 0 | 2019-05-08T07:28:29.009 | f502aede-f4f6-4397-a760-0e08248506dc |
4. Search for an endpoint
Search Minerva for an endpoint.
Base Command
minerva-search-endpoint
Input
| Argument Name | Description | Required |
|---|---|---|
| param | Parameter to search for. | Required |
| condition | A condition to apply to the search (“equalTo”, “notEqualTo”, “contain”, “notContain”, “startWith”, “endWith”). | Required |
| value | Value. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Endpoint.Group | string | The group to which the endpoint belongs. |
| Minerva.Endpoint.Name | string | The endpoint name. |
| Minerva.Endpoint.Users | string | The list of logged-on users. |
| Minerva.Endpoint.IP | string | The reported IP address. |
| Minerva.Endpoint.OS | string | The endpoint operating system. |
Command Example
!minerva-search-endpoint param="operatingSystem" condition="equalTo" value="Windows"
Human Readable Output
| Is Armor Version Supported | First Seen Online | Updated | Endpoint | Group | Operating System | Reported Ip Address | Anti Virus Signature Age | Logged On Users | Last Seen Online | Armor Version | Anti Virus Status | Agent Status | Days Registered | Id | Received Ip Address |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| true | 2019-05-07T11:18:38.2782338 | false | WIN2k16-ELIR-OWL | Default Group | Windows | 172.16.0.182 | Administrator | 2019-05-13T09:48:48.6032188 | 2.8.0.5173 | N/A | Online | 5 | {6368a324-139b-4765-98f5-5f8417fb296c} | 172.16.0.182 |
5. Get all groups
Fetches all the groups defined in Minerva Management Console.
Base Command
minerva-get-groups
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Group.Id | string | The ID of the group. |
| Minerva.Group.Name | string | The name of the group. |
| Minerva.Group.Policy | string | The policy applied to the group. |
| Minerva.Group.PolicyVersion | string | The policy version applied to the group. |
| Minerva.Group.EndpointSettings | string | The settings applied to the group. |
| Minerva.Group.Endpoints | number | The number of endpoints in the group. |
| Minerva.Group.Comment | string | The comment the group creator added. |
| Minerva.Group.CreationTime | date | The time the group was created. |
Command Example
!minerva-get-groups
Human Readable Output
| Name | Creation Time | Events | Endpoint Settings | Policy | Endpoints | Id | Policy Version |
|---|---|---|---|---|---|---|---|
| Default Group | 0001-01-01T00:00:00+00:00 | 0 | Fully Simulating | Main | 2 | DefaultAgentGroup | Version-946 |
6. Get mutex vaccines
Retrieves the mutex vaccines.
Base Command
minerva-get-vaccines
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Vaccine.Name | string | Mutex vaccination name. |
| Minerva.Vaccine.Description | string | Mutex vaccination description. |
| Minerva.Vaccine.isMonitorOnly | boolean | Whether this mutex vaccination is only monitored without simulation. |
| Minerva.Vaccine.lastModifiedBy | string | The user that last modified this mutex vaccination. |
| Minerva.Vaccine.lastModifiedOn | date | The date this mutex vaccination was last modified. |
| Minerva.Vaccine.Id | string | Mutex vaccination ID. |
Command Example
minerva-get-vaccines
Human Readable Output
| Last Modified On | Is Monitor Only | Name | Last Modified By | Type | Id | Description |
|---|---|---|---|---|---|---|
| 2019-05-14T07:36:21.6655031Z | true | Local\SomeVaccination | admin | Mutex | 9fef012d-b066-4dc3-a912-8f6613e5bef0 | A sample vaccination with local scope |
7. Delete a vaccine
Deletes a vaccine by the vaccine ID.
Base Command
minerva-delete-vaccine
Input
| Argument Name | Description | Required |
|---|---|---|
| vaccine_id | The ID of the specified vaccine. | Required |
Context Output
There is no context output for this command.
Command Example
!minerva-delete-vaccine vaccine_id=VACCINE_ID
Human Readable Output
Cortex XSOAR outputs: "Vaccine '9fef012d-b066-4dc3-a912-8f6613e5bef0' was deleted"
8. Get all exclusions
Retrieves all exclusions.
Base Command
minerva-get-exclusions
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| Minerva.Exclusion.Id | string | Exclusion ID. |
| Minerva.Exclusion.Type | string | Exclusion type. |
| Minerva.Exclusion.Data | string | Exclusion data. |
| Minerva.Exclusion.Description | string | Exclusion description. |
| Minerva.Exclusion.lastModifiedBy | string | The user that last modified this exclusion. |
| Minerva.Exclusion.lastModifiedOn | date | The date this exclusion was last modified. |
| Minerva.Exclusion.appliedGroupsIds | string | Group IDs to which this exclusion applies. |
Command Example
!minerva-get-exclusions
Human Readable Output
| Last Modified On | Description | Type | Applied Groups Ids | Last Modified By | Data | Id |
|---|---|---|---|---|---|---|
| 2019-05-13T09:39:38.2410566Z | Excluding explorer.exe by hash | hash | All Groups | admin | [“cef64201a97e08834f5c8952907a1719531a7d99b53309cb2e2956f40cff3486”,“cef64201a97e08834f5c8952907a1719531a7d99b53309cb2e2956f40cff3486”,“cef64201a97e08834f5c8952907a1719531a7d99b53309cb2e2956f40cff3486”] | a2ea76c5-95f5-4f40-88f6-bac40ce6d685 |
9. Delete an exclusion
Deletes an exclusion by the exclusion ID.
Base Command
minerva-delete-exclusion
Input
| Argument Name | Description | Required |
|---|---|---|
| id | Exclusion ID. | Required |
| type | Exclusion type. | Required |
Context Output
There is no context output for this command.
Command Example
!minerva-delete-exclusion id=EXCLUSION_ID type=hash
Human Readable Output
Cortex XSOAR outputs: "Exclusion a2ea76c5-95f5-4f40-88f6-bac40ce6d685 was deleted"
10. Move all events from Archive to New event state
Moves all the events from Archive state to New event state.
Base Command
minerva-unarchive-events
Input
There are no input arguments for this command.
Context Output
There is no context output for this command.
Command Example
!minerva-unarchive-events
Human Readable Output
Cortex XSOAR outputs: "Events were un-archived"
Known Limitations
- Users can’t add an already existing vaccination.
- Fetched events are archived in Minerva Console.
Configuration parameters
url— Minerva Management Console URL (required)credentials— Username (required)insecure— Trust any certificate (not secure)isFetch— Fetch incidentsincidentType— Incident typeincidentFetchInterval— Incidents Fetch Intervalproxy— Use system proxy settings
Commands (10)
-
minerva-add-exclusionAdd exclusions to Minerva Console.
-
minerva-add-vaccineVaccinate with Minerva.
-
minerva-delete-exclusionDeletes an exclusion by the exculsion ID.
-
minerva-delete-vaccineDeletes a vaccine by the vaccine ID.
-
minerva-get-exclusionsRetrieves all exclusions.
-
minerva-get-groupsFetches all the groups defined in Minerva Management Console.
-
minerva-get-vaccinesRetrieves the mutex vaccines.
-
minerva-search-endpointSearch Minerva for an endpoint.
-
minerva-search-processSearch processes with Minerva.
-
minerva-unarchive-eventsMoves all the events from Archive state to New event state.
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 """ IMPORTS """ import json import requests import urllib3 # Disable insecure warnings urllib3.disable_warnings() """ GLOBALS """ USERNAME = demisto.params().get("credentials").get("identifier") PASSWORD = demisto.params().get("credentials").get("password") BASE_URL = demisto.params().get("url") VERIFY_SSL = not demisto.params().get("insecure", False) """ HELPERS """ def get_session(): session = requests.Session() session.verify = VERIFY_SSL return session def create_entry_context(context_id, data): ec = {} if context_id.endswith("processes"): context = [] for process in data: process_context = { "Endpoint": process["endpoint"], "SHA256": process["fileHash"], "CommandLine": process["processCommandLine"], "Username": process["username"], "CreateTime": process["startTime"], "Pid": process["processId"], "Name": process["processName"], } context.append(process_context) ec["Minerva.Process(val.Id === obj.Id)"] = context elif context_id.endswith("endpoints"): context = [] for endpoint in data: endpoint_context = { "Group": endpoint["group"], "Name": endpoint["endpoint"], "Users": endpoint["loggedOnUsers"], "IP": endpoint["reportedIpAddress"], "OS": endpoint["operatingSystem"], } context.append(endpoint_context) ec["Minerva.Endpoint(val.Id === obj.Id)"] = context elif context_id.endswith("groups"): context = [] for group in data: group_context = { "Name": group["name"], "Id": group["id"], "Policy": group["policy"], "PolicyVersion": group["policyVersion"], "SimulationStatus": group["endpointSettings"], "Endpoints": group["endpoints"], "CreationTime": group["creationTime"], } context.append(group_context) ec["Minerva.Group(val.Id === obj.Id)"] = context elif context_id.endswith("vaccination"): context = [] if isinstance(data, list): for vaccine in data: vaccine_context = { "Id": vaccine["id"], "Name": vaccine["name"], "Type": vaccine["type"], "Description": vaccine["description"], "IsMonitorOnly": vaccine["isMonitorOnly"], "Last modified by": vaccine["lastModifiedBy"], "Last modified on": vaccine["lastModifiedOn"], } context.append(vaccine_context) ec["Minerva.Vaccine(val.Id === obj.Id)"] = context else: context = [ { "Id": data["id"], "Name": data["name"], "Type": data["type"], "Description": data["description"], "IsMonitorOnly": data["isMonitorOnly"], "Last modified by": data["lastModifiedBy"], "Last modified on": data["lastModifiedOn"], } ] ec["Minerva.Vaccine(val.Id === obj.Id)"] = context elif context_id.endswith("exclusions"): context = [] if isinstance(data, list): for exclusion in data: exclusion_context = { "Id": exclusion["id"], "Type": exclusion["type"], "Exclusion data": exclusion["data"], "Description": exclusion["description"], "Last modified by": exclusion["lastModifiedBy"], "Last modified on": exclusion["lastModifiedOn"], "Applied groups": exclusion["appliedGroupsIds"], } context.append(exclusion_context) ec["Minerva.Exclusion(val.Id === obj.Id)"] = context else: context = [ { "Id": data["id"], "Type": data["type"], "Exclusion data": data["data"], "Description": data["description"], "Last modified by": data["lastModifiedBy"], "Last modified on": data["lastModifiedOn"], "Applied groups": data["appliedGroupsIds"], } ] ec["Minerva.Exclusion(val.Id === obj.Id)"] = context else: demisto.debug(f"Failed to create entry context for {context_id}") return ec """ FUNCTIONS """ def get_from_url(url): url_text = url.split("/")[-1] response = session.get(url) if response.status_code != 200: return_error(f"Error while fetching {url_text}. More information: {response.status_code}, {response.reason}") if not response.json(): return { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": f"No contents retrieved for {url_text}", } return { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": response.json(), "HumanReadable": tableToMarkdown( pascalToSpace(url_text), response.json(), headerTransform=pascalToSpace, removeNull=True ), "EntryContext": create_entry_context(url_text, response.json()), } @logger def login(): return session.post(f"{BASE_URL}/api/login", json={"username": USERNAME, "password": PASSWORD}) @logger def logout(): session.post(f"{BASE_URL}/api/login/logout") def fetch_incidents(): try: r_events = session.post(f"{BASE_URL}/api/events", json={"archive": False}) if r_events.status_code != 200: raise Exception(f"Error in API call. More information: {r_events.status_code}, {r_events.reason}") incidents = [] for event in r_events.json(): incident = {"name": f'Minerva Labs Event - {event["type"]}', "rawJSON": json.dumps(event)} incidents.append(incident) session.put(f"{BASE_URL}/api/events/archive", json={"events": event["id"]}) demisto.incidents(incidents) except Exception as e: return_error(f"Error while fetching incidents. More information: {e}") @logger def get_groups(): get_groups_url = f"{BASE_URL}/api/groups" response = session.get(get_groups_url, params={"_limit": "1000"}) if response.status_code != 200 or not response.json(): return_error(f"Error while fetching groups. More information: {response.status_code}, {response.reason}") results = { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": response.json(), "HumanReadable": tableToMarkdown("Available groups", t=response.json(), headerTransform=pascalToSpace, removeNull=True), "EntryContext": create_entry_context(get_groups_url, response.json()), } demisto.results(results) @logger def add_exclusion(exclusion_type, exclusion_data, exclusion_description, groups_id): groups_ids_list = [group_id.strip() for group_id in groups_id.split(",")] json_params = { "type": exclusion_type, "description": exclusion_description, "data": exclusion_data, "appliedGroupsIds": groups_ids_list, } exclusions_url = f"{BASE_URL}/api/exclusions" response = session.post(exclusions_url, json=json_params) if response.status_code == 409 and response.reason == "Conflict": demisto.results("Exclusion already exists") return if response.status_code != 200: return_error(f"Error while adding exclusion. More information: {response.status_code}, {response.reason}") results = { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": response.json(), "HumanReadable": tableToMarkdown( f"Exclusion '{exclusion_description}' was added", response.json(), headerTransform=pascalToSpace, removeNull=True ), "EntryContext": create_entry_context(exclusions_url, response.json()), } demisto.results(results) @logger def get_exclusions(): results = get_from_url(f"{BASE_URL}/api/exclusions") demisto.results(results) @logger def delete_exclusion(exclusion_id, exclusion_type): json_params = {"id": exclusion_id, "type": exclusion_type} response = session.post(f"{BASE_URL}/api/exclusions/delete", json=[json_params]) if response.status_code != 200: return_error(f"Error while deleting exclusions. More information: {response.status_code}, {response.reason}") demisto.results(f"Exclusion {exclusion_id} was deleted") @logger def add_vaccine(vaccine_name, vaccine_desc, monitor_only): json_params = {"name": vaccine_name, "description": vaccine_desc, "isMonitorOnly": monitor_only, "type": "mutex"} vaccination_url = f"{BASE_URL}/api/vaccination" response = session.post(vaccination_url, json=json_params) if response.status_code == 409 and response.reason == "Conflict": demisto.results("Vaccination already exists") return if response.status_code != 200: return_error(f"Error while adding a vaccine. More information: {response.status_code}, {response.reason}") results = { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": response.json(), "HumanReadable": tableToMarkdown( f"Vaccination '{vaccine_desc}' was added", response.json(), headerTransform=pascalToSpace, removeNull=True ), } if response.json(): results["EntryContext"] = create_entry_context(vaccination_url, response.json()) demisto.results(results) @logger def get_vaccines(): results = get_from_url(f"{BASE_URL}/api/vaccination") demisto.results(results) @logger def delete_vaccines(vaccine_id): response = session.delete(f"{BASE_URL}/api/vaccination", params={"ids": [vaccine_id]}) if response.status_code == 404: demisto.results(f"Vaccination with id {vaccine_id} was not found") return if response.status_code != 200: return_error(f"Error while deleting vaccination id: {vaccine_id}. More information: {response.status_code},\ {response.reason}") demisto.results(f"Vaccine '{vaccine_id}' was deleted") @logger def search(search_url, search_param, search_condition, search_value): json_params = {"filters": [{"param": search_param, "condition": search_condition, "value": search_value}]} response = session.post(search_url, json=json_params) if response.status_code != 200: return_error(f'Error while perfroming search for\ {search_url.rsplit("/")[1]}. More information: {response.status_code}, {response.reason}') results = { "Type": entryTypes["note"], "ContentsFormat": formats["markdown"], "Contents": response.json(), "HumanReadable": tableToMarkdown( f'Search results for \'{search_url.split("/")[-1]}\'', response.json(), headerTransform=pascalToSpace, removeNull=True ), "EntryContext": create_entry_context(search_url, response.json()), } demisto.results(results) @logger def unarchive_events(): response = session.put(f"{BASE_URL}/api/events/archive", json={"shouldArchive": False}) if response.status_code != 200: return_error(f"Error while un-archiving events. More information: {response.status_code}, {response.reason}") demisto.results("Events were un-archived") """ EXECUTION """ session = get_session() try: handle_proxy() args = demisto.args() def add_exclusion_command(): exclusion_type = args.get("type") exclusion_data = args.get("data") exclusion_description = args.get("description") groups_id = args.get("appliedGroupsIds") add_exclusion(exclusion_type, exclusion_data, exclusion_description, groups_id) def delete_exclusion_command(): exclusion_id = args.get("id") exclusion_type = args.get("type") delete_exclusion(exclusion_id, exclusion_type) def add_vaccine_command(): vaccine_name = args.get("name") vaccine_desc = args.get("description") monitor_only = args.get("isMonitorOnly") add_vaccine(vaccine_name, vaccine_desc, monitor_only) def delete_vaccines_command(): vaccine_id = args.get("vaccine_id") delete_vaccines(vaccine_id) def search_process_command(): processes_search_url = f"{BASE_URL}/api/processes" search_param = args.get("param") search_condition = args.get("condition") search_value = args.get("value") search(processes_search_url, search_param, search_condition, search_value) def search_endpoint_command(): endpoint_search_url = f"{BASE_URL}/api/endpoints" search_param = args.get("param") search_condition = args.get("condition") search_value = args.get("value") search(endpoint_search_url, search_param, search_condition, search_value) def get_groups_command(): get_groups() demisto.debug(f"Command is {demisto.command()}") if USERNAME and PASSWORD: minerva_login = login() else: return_error("Failed to log in, no credentials were given") if demisto.command() == "fetch-incidents": fetch_incidents() elif demisto.command() == "test-module": if minerva_login.status_code == 200: # pylint: disable=E0606 demisto.results("ok") else: return_error(f"Failed to log in. More information: {minerva_login.status_code}, {minerva_login.reason}") elif demisto.command() == "minerva-add-exclusion": add_exclusion_command() elif demisto.command() == "minerva-get-exclusions": get_exclusions() elif demisto.command() == "minerva-delete-exclusion": delete_exclusion_command() elif demisto.command() == "minerva-add-vaccine": add_vaccine_command() elif demisto.command() == "minerva-get-vaccines": get_vaccines() elif demisto.command() == "minerva-delete-vaccine": delete_vaccines_command() elif demisto.command() == "minerva-search-process": search_process_command() elif demisto.command() == "minerva-search-endpoint": search_endpoint_command() elif demisto.command() == "minerva-get-groups": get_groups_command() elif demisto.command() == "minerva-unarchive-events": unarchive_events() except Exception as e: demisto.debug(f"Cannot perform the command: {demisto.command()}. Error: {e}") return_error(e) finally: logout()