-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathautomation-CPShowAccessRulebase.yml
45 lines (43 loc) · 1.32 KB
/
automation-CPShowAccessRulebase.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
args:
- default: true
description: Rulebase name. e.g. "Network"
name: name
- description: Rulebase uid. e.g. "c832198c-b48e-47db-bafd-ce2fdd5d3641"
name: uid
comment: Show items in an access rulebase configured in Checkpoint FW.
commonfields:
id: CPShowAccessRulebase
version: -1
dependson:
must:
- checkpoint
deprecated: true
name: CPShowAccessRulebase
runonce: false
script: |2-
dArgs = {'command': 'show-access-rulebase'}
uid = demisto.get(demisto.args(),'uid')
if uid:
dArgs['uid'] = uid
else:
hostObjName = demisto.get(demisto.args(),'name')
if hostObjName:
dArgs['name'] = hostObjName
if 'uid' in dArgs or 'name' in dArgs:
resp = demisto.executeCommand('checkpoint', dArgs)
if isError(resp[0]):
demisto.results(resp)
else:
data = demisto.get(resp[0], 'Contents.rulebase')
data = [{k: formatCell(row[k]) for k in row} for row in data]
if data:
demisto.results({'ContentsFormat': formats['table'], 'Type': entryTypes['note'], 'Contents': data} )
else:
demisto.results('No results.')
else:
demisto.results( { "Type" : entryTypes["error"], "ContentsFormat" : formats["text"], "Contents" : "You must provide name or uid." } )
scripttarget: 0
system: true
tags:
- checkpoint
type: python