Issue #1214. Now command module post_execute is honoured also with WebSockets channel.
This commit is contained in:
@@ -98,24 +98,27 @@ module BeEF
|
||||
# Sets the datastore for the callback function. This function is meant to be called by the CommandHandler
|
||||
# @param [Hash] http_params HTTP parameters
|
||||
# @param [Hash] http_headers HTTP headers
|
||||
def build_callback_datastore(http_params, http_headers, result, command_id, beefhook)
|
||||
def build_callback_datastore(result, command_id, beefhook, http_params, http_headers)
|
||||
@datastore = {'http_headers' => {}} # init the datastore
|
||||
|
||||
# get, check and add the http_params to the datastore
|
||||
http_params.keys.each { |http_params_key|
|
||||
(print_error 'http_params_key is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_key?(http_params_key)
|
||||
http_params_value = Erubis::XmlHelper.escape_xml(http_params[http_params_key])
|
||||
(print_error 'http_params_value is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_param?(http_params_value)
|
||||
@datastore[http_params_key] = http_params_value # add the checked key and value to the datastore
|
||||
}
|
||||
if http_params != nil && http_headers != nil
|
||||
# get, check and add the http_params to the datastore
|
||||
http_params.keys.each { |http_params_key|
|
||||
(print_error 'http_params_key is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_key?(http_params_key)
|
||||
http_params_value = Erubis::XmlHelper.escape_xml(http_params[http_params_key])
|
||||
(print_error 'http_params_value is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_param?(http_params_value)
|
||||
@datastore[http_params_key] = http_params_value # add the checked key and value to the datastore
|
||||
}
|
||||
|
||||
# get, check and add the http_headers to the datastore
|
||||
http_headers.keys.each { |http_header_key|
|
||||
(print_error 'http_header_key is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_key?(http_header_key)
|
||||
http_header_value = Erubis::XmlHelper.escape_xml(http_headers[http_header_key][0])
|
||||
(print_error 'http_header_value is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_param?(http_header_value)
|
||||
@datastore['http_headers'][http_header_key] = http_header_value # add the checked key and value to the datastore
|
||||
}
|
||||
end
|
||||
|
||||
# get, check and add the http_headers to the datastore
|
||||
http_headers.keys.each { |http_header_key|
|
||||
(print_error 'http_header_key is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_key?(http_header_key)
|
||||
http_header_value = Erubis::XmlHelper.escape_xml(http_headers[http_header_key][0])
|
||||
(print_error 'http_header_value is invalid';return) if not BeEF::Filters.is_valid_command_module_datastore_param?(http_header_value)
|
||||
@datastore['http_headers'][http_header_key] = http_header_value # add the checked key and value to the datastore
|
||||
}
|
||||
@datastore['results'] = result
|
||||
@datastore['cid'] = command_id
|
||||
@datastore['beefhook'] = beefhook
|
||||
|
||||
Reference in New Issue
Block a user