@@ -29,7 +29,7 @@ def domain_input_filter(action=None, success=None, container=None, results=None,
29
29
matched_artifacts_1 , matched_results_1 = phantom .condition (
30
30
container = container ,
31
31
conditions = [
32
- ["playbook_input:input_domain " , "!=" , None ]
32
+ ["playbook_input:domain " , "!=" , None ]
33
33
],
34
34
name = "domain_input_filter:condition_1" ,
35
35
delimiter = None )
@@ -51,15 +51,15 @@ def block_domain(action=None, success=None, container=None, results=None, handle
51
51
# Block domains in Cisco Umbrella based on given domains.
52
52
################################################################################
53
53
54
- filtered_input_0_input_domain = phantom .collect2 (container = container , datapath = ["filtered-data:domain_input_filter:condition_1: playbook_input:input_domain " ])
54
+ playbook_input_domain = phantom .collect2 (container = container , datapath = ["playbook_input:domain " ])
55
55
56
56
parameters = []
57
57
58
58
# build parameters list for 'block_domain' call
59
- for filtered_input_0_input_domain_item in filtered_input_0_input_domain :
60
- if filtered_input_0_input_domain_item [0 ] is not None :
59
+ for playbook_input_domain_item in playbook_input_domain :
60
+ if playbook_input_domain_item [0 ] is not None :
61
61
parameters .append ({
62
- "domain" : filtered_input_0_input_domain_item [0 ],
62
+ "domain" : playbook_input_domain_item [0 ],
63
63
})
64
64
65
65
################################################################################
@@ -72,7 +72,7 @@ def block_domain(action=None, success=None, container=None, results=None, handle
72
72
## Custom Code End
73
73
################################################################################
74
74
75
- phantom .act ("block domain" , parameters = parameters , name = "block_domain" , assets = ["cisco_umbrella" ], callback = build_observable )
75
+ phantom .act ("block domain" , parameters = parameters , name = "block_domain" , assets = ["cisco_umbrella" ], callback = success_filter )
76
76
77
77
return
78
78
@@ -86,10 +86,10 @@ def build_observable(action=None, success=None, container=None, results=None, ha
86
86
# the observables data path.
87
87
################################################################################
88
88
89
- block_domain_result_data = phantom .collect2 (container = container , datapath = ["block_domain:action_result.parameter.domain" ,"block_domain:action_result.status" ], action_results = results )
89
+ filtered_result_0_data_success_filter = phantom .collect2 (container = container , datapath = ["filtered-data:success_filter:condition_1: block_domain:action_result.parameter.domain" ,"filtered-data:success_filter:condition_1: block_domain:action_result.status" ])
90
90
91
- block_domain_parameter_domain = [item [0 ] for item in block_domain_result_data ]
92
- block_domain_result_item_1 = [item [1 ] for item in block_domain_result_data ]
91
+ filtered_result_0_parameter_domain = [item [0 ] for item in filtered_result_0_data_success_filter ]
92
+ filtered_result_0_status = [item [1 ] for item in filtered_result_0_data_success_filter ]
93
93
94
94
build_observable__observable_array = None
95
95
@@ -98,7 +98,7 @@ def build_observable(action=None, success=None, container=None, results=None, ha
98
98
################################################################################
99
99
100
100
build_observable__observable_array = list ()
101
- for status , domain in zip (block_domain_result_item_1 , block_domain_parameter_domain ):
101
+ for status , domain in zip (filtered_result_0_status , filtered_result_0_parameter_domain ):
102
102
if status == "success" :
103
103
observable = {
104
104
"type" : "domain" ,
@@ -118,6 +118,30 @@ def build_observable(action=None, success=None, container=None, results=None, ha
118
118
return
119
119
120
120
121
+ @phantom .playbook_block ()
122
+ def success_filter (action = None , success = None , container = None , results = None , handle = None , filtered_artifacts = None , filtered_results = None , custom_function = None , ** kwargs ):
123
+ phantom .debug ("success_filter() called" )
124
+
125
+ ################################################################################
126
+ # Determine if the block domain was successful.
127
+ ################################################################################
128
+
129
+ # collect filtered artifact ids and results for 'if' condition 1
130
+ matched_artifacts_1 , matched_results_1 = phantom .condition (
131
+ container = container ,
132
+ conditions = [
133
+ ["block_domain:action_result.status" , "==" , "success" ]
134
+ ],
135
+ name = "success_filter:condition_1" ,
136
+ delimiter = None )
137
+
138
+ # call connected blocks if filtered artifacts or results
139
+ if matched_artifacts_1 or matched_results_1 :
140
+ build_observable (action = action , success = success , container = container , results = results , handle = handle , filtered_artifacts = matched_artifacts_1 , filtered_results = matched_results_1 )
141
+
142
+ return
143
+
144
+
121
145
@phantom .playbook_block ()
122
146
def on_finish (container , summary ):
123
147
phantom .debug ("on_finish() called" )
0 commit comments