forked from shaniacht1/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-CBSessions.yml
44 lines (44 loc) · 1.11 KB
/
automation-CBSessions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
args:
- description: Show more detailed output
name: verbose
comment: List Carbon Black sessions
commonfields:
id: CBSessions
version: -1
dependson:
must:
- cb-list-sessions
name: CBSessions
runonce: false
script: |-
//Show a list of carbon black sessions.
//Argument: Verbose = true, to show all properties.
var output = [];
var entries = executeCommand("cb-list-sessions", {});
var array = entries[0].Contents;
var outTable = [];
for (var index in array) {
var item = array[index];
var outItem = {};
if (args.verbose === "true") {
for (var name in item) {
var value = item[name];
if (typeof (value) !== "object") {
outItem[name] = value;
}
}
} else {
outItem["status"] = item["status"];
outItem["id"] = item["id"];
outItem["sensor"]=item["sensor_id"];
}
outTable.push(outItem);
}
output.push({ContentsFormat: formats.table, Type: entryTypes.note, Contents: outTable});
return output;
scripttarget: 0
system: true
tags:
- carbon-black
- endpoint
type: javascript