enable post requests + fix encoding bug

This commit is contained in:
thomashaw
2022-11-13 13:09:21 +00:00
parent 7574f9278b
commit 04cb14cf02
3 changed files with 9 additions and 14 deletions

View File

@@ -53,11 +53,11 @@ class GoalMessageHost < StringGenerator
when '--recipient'
self.recipient = arg
when '--message_header'
self.message_header = arg
self.message_header = arg.force_encoding('UTF-8')
when '--message_subtext'
self.message_subtext = arg
self.message_subtext = arg.force_encoding('UTF-8')
when '--mappings'
self.mappings << arg
self.mappings << arg.force_encoding('UTF-8')
when '--mapping_type'
self.mapping_type = arg
end

View File

@@ -56,9 +56,9 @@ class GoalMessageMap < StringGenerator
when '--recipient'
self.recipient = arg
when '--message_header'
self.message_header = arg
self.message_header = arg.force_encoding('UTF-8')
when '--message_subtext'
self.message_subtext = arg
self.message_subtext = arg.force_encoding('UTF-8')
end
end
end

View File

@@ -16,10 +16,6 @@ class WebActioner < AlertActioner
end
def perform_action
Print.info "WebActioner disabled for testing - uncomment me when pushed to Hacktivity (web_actioner.rb:19)"
end
def perform_actions
Print.info "Running WebActioner", logger
# uri = URI.parse("http://www.google.com")
uri = URI.parse(self.target_host)
@@ -43,9 +39,9 @@ class WebActioner < AlertActioner
Print.info " Request Data: \n", logger
Print.info(request.body, logger)
# response = http.request(request)
# Print.info " Response: \n", logger
# Print.info(response, logger)
response = http.request(request)
Print.info " Response: \n", logger
Print.info(response, logger)
when 'PUT'
# TODO: later
response = ''
@@ -55,8 +51,7 @@ class WebActioner < AlertActioner
else
response = Net::HTTP.get_response(uri)
end
# Print.info response.body.to_s, logger
Print.warn("TODO: uncomment web_actioner.rb when merging", logger) # TODO: uncomment web_actioner.rb when merging
Print.info response.body.to_s, logger
Print.info "Web Action complete #{alertactioner_name}", logger
end