-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathautomation-CheckWhitelist.yml
44 lines (44 loc) · 1.22 KB
/
automation-CheckWhitelist.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:
- default: true
description: Item to check
name: item
required: true
- defaultValue: Indicators Whitelist
description: Name of whitelist to check
name: whitelistname
comment: Check whether the given item is in the whitelist
commonfields:
id: CheckWhitelist
version: -1
deprecated: true
name: CheckWhitelist
outputs:
- contextPath: WhitelistCheck
description: Returns a dictionary of indicators mapped to True if found in whitelist,
or False otherwise.
runonce: false
script: |
res = demisto.executeCommand("getList", {"listName": demisto.args()["whitelistname"]})
if isError(res[0]):
demisto.results(res)
else:
whitelist = res[0]['Contents']
result = False
answer = 'no'
if demisto.args()['item'] in whitelist:
answer = 'yes'
result = True
contextKey = "WhitelistCheck"
contextValue = demisto.get(demisto.context(), contextKey)
contextDic = { demisto.args()['item']: result }
if contextValue:
contextValue.update(contextDic)
demisto.setContext(contextKey, contextValue)
else:
demisto.setContext(contextKey, contextDic)
demisto.results(answer)
scripttarget: 0
system: true
tags:
- whitelist
type: python