In a custom code block given the following psuedo code:
def promptIpToBlock(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None):
phantom.debug('promptIpToBlock() called')
# set user and message variables for phantom.prompt call
user = phantom.get_run_data("logged_in_user")
message = """Enter IP/CIDR addresses to be blocked"""
#responses:
response_types = [
{
"prompt": "",
"options": {
"type": "message",
},
},
]
phantom.prompt2(container=container, user=user, message=message, respond_in_mins=5, name="prompt_ip_to_block", response_types=response_types, callback=checkIpAgainstWhitelist)
return
def checkIpAgainstWhitelist(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None):
myVar = phantom.get_run_data(key='prompt_ip_to_block')
phantom.debug("myVar: {}".format(myVar))
# check for 'if' condition 1
matched_artifacts_1, matched_results_1 = phantom.condition(
container=container,
action_results=results,
conditions=[
["(phantom.valid_ip(promptIpToBlock:action_result.summary.responses.0) or phantom.valid_net(promptIpToBlock:action_result.summary.responses.0))", "==", "true"],
])
# call connected blocks for 'else' condition 4
join_formatBlockParamteres(action=action, success=success, container=container, results=results, handle=handle)
return
'myVar' doesn't show up in checkIPAgainstWhitelist(). Am I using the correct API call to get the data from promptIpToBlock()?
... View more