-
Notifications
You must be signed in to change notification settings - Fork 15
/
HelloWorld_Scan.yml
348 lines (346 loc) · 8.82 KB
/
HelloWorld_Scan.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
id: HelloWorld Scan
version: 1
contentitemexportablefields:
contentitemfields:
packID: HelloWorld
packName: HelloWorld
itemVersion: 1.2.10
fromServerVersion: 5.0.0
toServerVersion: ""
definitionid: ""
vcShouldKeepItemLegacyProdMachine: false
name: HelloWorld Scan
description: |-
This Playbook simulates a vulnerability scan using the "HelloWorld" sample integration. It's used to demonstrate how to use the GenericPolling mechanism to run jobs that take several seconds or minutes to complete. It is designed to be used as a subplaybook, but you can also use it as a standalone playbook, by providing the ${Endpoint.Hostname} input in the Context.
Other inputs include the report output format (JSON context or File attached), and the Interval/Timeouts to use for polling the scan status until it's complete.
starttaskid: "0"
tasks:
"0":
id: "0"
taskid: dafe8c51-8798-4472-8b0d-b9cfc1b1b613
type: start
task:
id: dafe8c51-8798-4472-8b0d-b9cfc1b1b613
version: -1
name: ""
iscommand: false
brand: ""
nexttasks:
'#none#':
- "5"
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 50
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"1":
id: "1"
taskid: 6b00143b-8523-4436-8950-adfd73869e64
type: regular
task:
id: 6b00143b-8523-4436-8950-adfd73869e64
version: -1
name: Start a Hello World Scan
description: Start a HelloWorld scan on an asset, identified from by ${input.Hostname}
key.
script: '|||helloworld-scan-start'
type: regular
iscommand: true
brand: ""
nexttasks:
'#none#':
- "2"
scriptarguments:
hostname:
simple: ${inputs.Hostname}
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 50,
"y": 370
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"2":
id: "2"
taskid: 658053d1-8d16-45b8-8241-f0e0f1f9d982
type: playbook
task:
id: 658053d1-8d16-45b8-8241-f0e0f1f9d982
version: -1
name: GenericPolling
description: |-
Use this playbook as a sub-playbook to block execution of the master playbook until a remote action is complete.
This playbook implements polling by continuously running the command in Step \#2 until the operation completes.
The remote action should have the following structure:
1. Initiate the operation.
2. Poll to check if the operation completed.
3. (optional) Get the results of the operation.
playbookName: GenericPolling
type: playbook
iscommand: false
brand: ""
nexttasks:
'#none#':
- "3"
scriptarguments:
Ids:
simple: ${HelloWorld.Scan.scan_id}
Interval:
simple: ${inputs.Interval}
PollingCommandArgName:
simple: scan_id
PollingCommandName:
simple: helloworld-scan-status
Timeout:
simple: ${inputs.Timeout}
dt:
simple: HelloWorld.Scan(val.status !== 'COMPLETE').scan_id
separatecontext: true
continueonerrortype: ""
loop:
iscommand: false
exitCondition: ""
wait: 1
max: 100
view: |-
{
"position": {
"x": 50,
"y": 545
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"3":
id: "3"
taskid: 48a7dfde-e420-48b7-8a04-59f423ee4e52
type: regular
task:
id: 48a7dfde-e420-48b7-8a04-59f423ee4e52
version: -1
name: Retrieve HelloWorld Scan Results
description: Retrieve scan status in Context or as a File (default) for a Scan.
script: '|||helloworld-scan-results'
type: regular
iscommand: true
brand: ""
nexttasks:
'#none#':
- "4"
scriptarguments:
format:
simple: ${inputs.Report Format}
scan_id:
simple: ${HelloWorld.Scan.scan_id}
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 50,
"y": 720
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"4":
id: "4"
taskid: 480e9af4-1e53-4351-8a6e-3e0d9a369cc0
type: title
task:
id: 480e9af4-1e53-4351-8a6e-3e0d9a369cc0
version: -1
name: Done
type: title
iscommand: false
brand: ""
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 895
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"5":
id: "5"
taskid: 0449752f-d12c-45e8-8bb9-1465da7e57f7
type: condition
task:
id: 0449752f-d12c-45e8-8bb9-1465da7e57f7
version: -1
name: Is Hostname set?
description: Check if the input Hostname is valid (i.e. is not Empty), do not
run the scan otherwise.
type: condition
iscommand: false
brand: ""
nexttasks:
'#default#':
- "6"
"true":
- "1"
separatecontext: false
conditions:
- label: "true"
condition:
- - operator: isNotEmpty
left:
value:
simple: inputs.Hostname
iscontext: true
continueonerrortype: ""
view: |-
{
"position": {
"x": 265,
"y": 195
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
"6":
id: "6"
taskid: 77b84196-1f07-4013-8f31-863e7315d3b4
type: regular
task:
id: 77b84196-1f07-4013-8f31-863e7315d3b4
version: -1
name: Print Error
description: Prints an error entry with a given message
scriptName: PrintErrorEntry
type: regular
iscommand: false
brand: ""
nexttasks:
'#none#':
- "4"
scriptarguments:
message:
simple: Hostname is not set, cannot run the playbook!
separatecontext: false
continueonerrortype: ""
view: |-
{
"position": {
"x": 480,
"y": 720
}
}
note: false
timertriggers: []
ignoreworker: false
skipunavailable: false
quietmode: 0
isoversize: false
isautoswitchedtoquietmode: false
system: true
view: |-
{
"linkLabelsPosition": {},
"paper": {
"dimensions": {
"height": 910,
"width": 810,
"x": 50,
"y": 50
}
}
}
inputs:
- key: Hostname
value:
complex:
root: ${Endpoint
accessor: Hostname}
required: true
description: Hostname to run the scan against. By default takes ${Endpoint.Hostname}
from the context as the input.
playbookInputQuery: null
- key: Report Format
value:
simple: json
required: true
description: 'Output report format: can be "json" (output parsed and written in
the Context) or "file" (saved as an attachment). By default is "json".'
playbookInputQuery: null
- key: Interval
value:
simple: "1"
required: true
description: How often to check for the scan to be completed (minutes)
playbookInputQuery: null
- key: Timeout
value:
simple: "15"
required: true
description: How long to wait for the scan to be completed before timing out (minutes)
playbookInputQuery: null
outputs:
- contextPath: HelloWorld.Scan.entity.entity-id
description: Scanned entity ID.
- contextPath: HelloWorld.Scan.entity.ip_address
description: Scanned entity IP address.
- contextPath: HelloWorld.Scan.entity.type
description: Scanned entity type.
- contextPath: HelloWorld.Scan.entity.vulnerability_status
description: Scanned entity vulnerability status.
- contextPath: HelloWorld.Scan.entity.vulns
description: Scanned entity CVE.
- contextPath: CVE.ID
description: The ID of the CVE.
- contextPath: InfoFile.EntryID
description: The EntryID of the report file.
- contextPath: InfoFile.Extension
description: The extension of the report file.
- contextPath: InfoFile.Name
description: The name of the report file.
- contextPath: InfoFile.Info
description: The info of the report file.
- contextPath: InfoFile.Size
description: The size of the report file.
- contextPath: InfoFile.Type
description: The type of the report file.