CBPFindComputer

Find a computer in CBEP/Bit9.

python · Carbon Black Enterprise Protection

Details

IDCBPFindComputer
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagscarbon-black-protection bit9

README

Finds a computer in CBEP/Bit9.

Script Data


Name Description
Script Type python
Tags carbon-black-protection, bit9

Dependencies


This script uses the following commands and scripts.

  • cbp-computer-search

Inputs


Argument Name Description
query Only shows computers matching this query. If omitted, all computers will be displayed. The query is in CBEP/Bit9 syntax, documented here. For example, “name:srv”.

Outputs


There are no outputs for this script.

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


def test_cbp_find_computer(mocker):
    from CBPFindComputer import cbp_find_computer

    args = {"limit": 2}
    computer = [
        {"Type": 3, "Contents": {"getTicketResponse": {"some_info": {"info": "test"}}}},
        {
            "Type": 3,
        },
    ]
    mocker.patch.object(demisto, "executeCommand", return_value=computer)
    mocker.patch.object(demisto, "results")
    cbp_find_computer(args)
    res = demisto.results
    content = res.call_args[0][0]
    expected_res = [
        {"Type": 1, "ContentsFormat": "table", "Contents": {"getTicketResponse": {"some_info": {"info": "test"}}}},
        {"Type": 1, "ContentsFormat": "text", "Contents": "No matches."},
    ]
    assert expected_res == content