CBPFindComputer
Find a computer in CBEP/Bit9.
- Type
- python
- Pack
- CarbonBlackProtect
Source
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def cbp_find_computer(args):
# query syntax is according to Carbon Black Enterprise Protection query language documented in
# https://developer.carbonblack.com/reference/enterprise-protection/7.2/rest-api/#query-condition - e.g. "name:*srv*"
res = []
if "limit" not in args:
args["limit"] = "10"
resCmd1 = demisto.executeCommand("cbp-computer-search", args)
for entry in resCmd1:
if isError(entry):
res.append(entry)
else:
matches = entry.get("Contents")
if matches:
res.append({"Type": entryTypes["note"], "ContentsFormat": formats["table"], "Contents": matches})
else:
res.append({"Type": entryTypes["note"], "ContentsFormat": formats["text"], "Contents": "No matches."})
demisto.results(res)
def main(): # pragma: no cover
args = demisto.args()
try:
cbp_find_computer(args)
except Exception as e:
err_msg = f"Encountered an error while running the script: [{e}]"
return_error(err_msg, error=e)
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
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.