From 78f8c0e59775fbf49024cc9b70bda4037ce2af9a Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Fri, 18 Oct 2024 16:53:48 +0100 Subject: [PATCH] Hackerbot update --- .../unix/hackerbot/files/opt_hackerbot/hackerbot.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/utilities/unix/hackerbot/files/opt_hackerbot/hackerbot.rb b/modules/utilities/unix/hackerbot/files/opt_hackerbot/hackerbot.rb index d4cab547c..e64afc9a2 100644 --- a/modules/utilities/unix/hackerbot/files/opt_hackerbot/hackerbot.rb +++ b/modules/utilities/unix/hackerbot/files/opt_hackerbot/hackerbot.rb @@ -216,6 +216,11 @@ def read_bots (irc_server_ip_address) shell_outputs = bots[bot_name]['attacks'][current]['shell_command_outputs'].map { |output| output.lines.first.to_s.strip }.join('|') correct_answer.gsub!(/{{shell_command_output_first_line}}/, shell_outputs) end + if bots[bot_name]['attacks'][current].key?('pre_shell') + pre_shell_outputs = bots[bot_name]['attacks'][current]['pre_shell_command_outputs'] || [] + pre_shell_output = pre_shell_outputs.map { |output| output.lines.first.to_s.strip }.join('|') + correct_answer.gsub!(/{{pre_shell_command_output_first_line}}/, pre_shell_output) + end correct_answer.chomp! Print.debug "#{correct_answer}====#{answer}" @@ -317,9 +322,9 @@ def read_bots (irc_server_ip_address) unless bots[bot_name]['attacks'][current].key?('suppress_command_output_feedback') m.reply "FYI: #{pre_output}" end - bots[bot_name]['attacks'][current]['get_shell_command_output'] = pre_output + bots[bot_name]['attacks'][current]['pre_shell_command_outputs'] ||= [] + bots[bot_name]['attacks'][current]['pre_shell_command_outputs'] << pre_output current = check_output_conditions(bot_name, bots, current, pre_output, m) - end # use bot-wide method for obtaining shell, unless specified per-attack @@ -513,4 +518,4 @@ opts.each do |opt, arg| end bots = read_bots(irc_server_ip_address) -start_bots(bots) \ No newline at end of file +start_bots(bots)