Penfield

The penfield-get-assignee command takes in necessary context data, and returns the analyst that Penfield believes the incident should be assigned to based on Penfield's models of skill and process. The test command verfies that the endpoint is reachable.

Case Management · PenfieldAI

Details

IDPenfield
ProviderPenfieldAI
CategoryCase Management
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Supported ModulesAgentix XSIAM

README

The penfield-get-assignee command takes in necessary context data, and returns the analyst that Penfield believes the incident should be assigned to based on Penfield’s models of skill and process. The test command verfies that the endpoint is reachable.
This integration was integrated and tested with version 0.1.4 of Penfield

Configure Penfield in Cortex

Parameter Description Required
Your server URL   True
API Key The API Key to use for connection True
Trust any certificate (not secure) Trust any certificate (not secure). False
Use system proxy settings 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.

penfield-get-assignee


Calls the Penfield API and returns the analyst Penfield recommends assigning the incident to. This information is saved in the output, but the incident will not be automatically assigned.

Base Command

penfield-get-assignee

Input

Argument Name Description Required
analyst_ids An array of XSOAR analyst IDs for Penfield to choose from when determining who to assign to. Required
category The category of the incident to assign. Can be taken from incident Context Data. Required
created The creation_date of the incident to assign. Can be taken from incident Context Data. Required
id The id of the incident to assign. Can be taken from incident Context Data. Required
name The name of the incident to assign. Can be taken from incident Context Data. Required
severity The severity of the incident to assign. Can be taken from incident Context Data. Required

Context Output

Parameter Description
Penfield.Recommended The analyst Penfield recommends assigning this incident too.

Command Example

!penfield-get-assignee analyst_ids=['analystid1', 'analystid2'] category='my cat' created='2021-09-13T01:58:22.621033322Z' id=34 name='big rootkit attack' severity='High'

Human Readable Output

peter

Configuration parameters

  • url — Your server URL (required)
  • apikey — API Key (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (1)

  • penfield-get-assignee

    Calls the Penfield API and returns the analyst Penfield recommends assigning the incident to. This information is saved in the output, but the incident will not be automatically assigned.

import json

import demistomock as demisto
from Penfield import Client, get_assignee, main


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


def test_main(mocker):
    mock_users = "username1,username2"
    mock_incident = util_load_json("test_data/test_incident.json")

    mocker.patch.object(demisto, "command", return_value="penfield-get-assignee")
    mocker.patch.object(demisto, "args", return_value={"analysts": mock_users, "incident": mock_incident})
    mocker.patch("Penfield.get_assignee", return_value="test")
    mocker.patch.object(demisto, "results")
    mocker.patch.object(demisto, "params", return_value={"url": "https://fakeurl.ai/api/v1/xsoar_live_assign/"})

    main()

    assert demisto.results.call_args.args[0] == "test"


def test_get_assignee(mocker):
    mock_users = "username1,username2"

    mocker.patch.object(
        demisto,
        "args",
        return_value={
            "analyst_ids": mock_users,
            "category": "test_category",
            "created": "2021-03-02",
            "arg_id": 123,
            "name": "test name",
            "severity": "high",
        },
    )
    mocker.patch("Penfield.Client.live_assign_get", return_value="test_cr_response")

    api_key = demisto.params().get("apikey")
    base_url = "https://test.com"
    verify_certificate = not demisto.params().get("insecure", False)
    proxy = demisto.params().get("proxy", False)

    headers = {"Authorization": f"Bearer {api_key}"}
    client = Client(base_url=base_url, verify=verify_certificate, headers=headers, proxy=proxy)

    assert type(get_assignee(client, demisto.args())).__name__ == "CommandResults"