fix for issue 16 (datastore nil instead of string)

git-svn-id: https://beef.googlecode.com/svn/trunk@807 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
mosse.benjamin
2011-03-25 12:00:45 +00:00
parent 3c892f1bb9
commit ecd1e428b6
2 changed files with 7 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ module BeEF
# Super class controller
def initialize(info)
@info = info
@datastore = @info['Data'] || nil
@datastore = @info['Data'] || {}
@friendlyname = @info['Name'] || nil
@target = @info['Target'] || nil
@output = ''
@@ -94,7 +94,7 @@ module BeEF
# Builds the 'datastore' attribute of the command which is used to generate javascript code.
def build_datastore(data);
@datastore = JSON.parse(data);
@datastore = JSON.parse(data)
end
# Sets the datastore for the callback function. This function is meant to be called by the CommandHandler

View File

@@ -100,10 +100,6 @@ module Modules
raise WEBrick::HTTPStatus::BadRequest, "zombie.session is nil" if zombie.session.nil?
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.instructions_sent = true
command.save
# get the command module
command_module = BeEF::Models::CommandModule.first(:id => command.command_module_id)
@@ -111,7 +107,7 @@ module Modules
raise WEBrick::HTTPStatus::BadRequest, "command_module.path is nil" if command_module.path.nil?
klass = File.basename command_module.path, '.rb'
@guard.synchronize {
command_module = BeEF::Modules::Commands.const_get(klass.capitalize).new
command_module.command_id = command.id
@@ -126,6 +122,10 @@ module Modules
puts "+ Hooked browser #{zombie.ip} sent command module #{klass}" if @cmd_opts[:verbose]
}
# flag that the command has been sent to the hooked browser
command.instructions_sent = true
command.save
end
#