Updated to fix Issue 186.
Previously, if a HB did not return a module result the instructions are resent. This update stops that and will only send the module instructions once. git-svn-id: https://beef.googlecode.com/svn/trunk@665 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -35,16 +35,12 @@ class Command
|
||||
zombie_ip = zombie.ip
|
||||
|
||||
# get the command module data structure from the database
|
||||
command = first(:id => command_id.to_i, :has_run => false, :zombie_id => zombie_id) || nil
|
||||
command = first(:id => command_id.to_i, :zombie_id => zombie_id) || nil
|
||||
raise WEBrick::HTTPStatus::BadRequest, "command is nil" if command.nil?
|
||||
|
||||
# create the entry for the results
|
||||
command.results.new(:zombie_id => zombie_id, :data => result, :date => Time.now.to_i)
|
||||
|
||||
# flag that the command has run and the results have been returned
|
||||
command.has_run = true
|
||||
|
||||
# write the data to the database
|
||||
command.save
|
||||
|
||||
# log that the result was returned
|
||||
|
||||
@@ -97,6 +97,10 @@ module Modules
|
||||
raise WEBrick::HTTPStatus::BadRequest, "zombie is nil" if command.nil?
|
||||
raise WEBrick::HTTPStatus::BadRequest, "zombie.session is nil" if command.command_module_id.nil?
|
||||
|
||||
# flag that the command has been sent to the hooked browser
|
||||
command.has_run = true
|
||||
command.save
|
||||
|
||||
# get the command module
|
||||
command_module = BeEF::Models::CommandModule.first(:id => command.command_module_id)
|
||||
raise WEBrick::HTTPStatus::BadRequest, "command_module is nil" if command_module.nil?
|
||||
|
||||
@@ -55,7 +55,7 @@ module BeEF
|
||||
hooked_browser.save
|
||||
|
||||
execute_plugins!
|
||||
|
||||
|
||||
# add all availible command module instructions to the response
|
||||
zombie_commands = BeEF::Models::Command.all(:zombie_id => hooked_browser.id, :has_run => false)
|
||||
zombie_commands.each{|command| add_command_instructions(command, hooked_browser)}
|
||||
|
||||
Reference in New Issue
Block a user