From 0574bdf00297c7d5acd8e56a347186243591c024 Mon Sep 17 00:00:00 2001 From: Ben Passmore Date: Wed, 9 Oct 2019 10:03:27 +1000 Subject: [PATCH] Moved autorun models to active record core models --- core/bootstrap.rb | 2 -- core/core.rb | 2 ++ core/main/autorun_engine/models/execution.rb | 31 ------------------ core/main/autorun_engine/models/rule.rb | 34 -------------------- core/main/models/execution.rb | 14 ++++++++ core/main/models/rule.rb | 16 +++++++++ 6 files changed, 32 insertions(+), 67 deletions(-) delete mode 100644 core/main/autorun_engine/models/execution.rb delete mode 100644 core/main/autorun_engine/models/rule.rb create mode 100644 core/main/models/execution.rb create mode 100644 core/main/models/rule.rb diff --git a/core/bootstrap.rb b/core/bootstrap.rb index 9be4b48b65..2eb259cb7b 100644 --- a/core/bootstrap.rb +++ b/core/bootstrap.rb @@ -30,8 +30,6 @@ module Core require 'core/main/network_stack/api' # @note Include the autorun engine -require 'core/main/autorun_engine/models/rule' -require 'core/main/autorun_engine/models/execution' require 'core/main/autorun_engine/parser' require 'core/main/autorun_engine/engine' require 'core/main/autorun_engine/rule_loader' diff --git a/core/core.rb b/core/core.rb index 2f6914ae02..ca989944a2 100644 --- a/core/core.rb +++ b/core/core.rb @@ -18,6 +18,8 @@ module Core require 'core/main/models/result' require 'core/main/models/optioncache' require 'core/main/models/browserdetails' +require 'core/main/models/rule' +require 'core/main/models/execution' # @note Include the constants require 'core/main/constants/browsers' diff --git a/core/main/autorun_engine/models/execution.rb b/core/main/autorun_engine/models/execution.rb deleted file mode 100644 index cc22c709fd..0000000000 --- a/core/main/autorun_engine/models/execution.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - http://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -module BeEF - module Core - module AutorunEngine - module Models - # @note Stored info about the execution of the ARE on hooked browsers. - class Execution - - include DataMapper::Resource - - storage_names[:default] = 'core_areexecution' - - property :id, Serial - property :session, Text # hooked browser session where a ruleset triggered - property :mod_count, Integer # number of command modules of the ruleset - property :mod_successful, Integer # number of command modules that returned with success - # By default Text is only 65K, so field length increased to 1 MB - property :mod_body, Text, :length => 1024000 # entire command module(s) body to be sent - property :exec_time, String, :length => 15 # timestamp of ruleset triggering - property :rule_token, String, :length => 10 # unique token to be appended to wrapper function names - property :is_sent, Boolean - end - end - end - end -end diff --git a/core/main/autorun_engine/models/rule.rb b/core/main/autorun_engine/models/rule.rb deleted file mode 100644 index 56a5df9253..0000000000 --- a/core/main/autorun_engine/models/rule.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - http://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -module BeEF - module Core - module AutorunEngine - module Models - # @note Table stores the rules for the Distributed Engine. - class Rule - include DataMapper::Resource - - storage_names[:default] = 'core_arerules' - - property :id, Serial - property :name, Text # rule name - property :author, String # rule author - property :browser, String, :length => 10 # browser name - property :browser_version, String, :length => 15 # browser version - property :os, String, :length => 10 # OS name - property :os_version, String, :length => 15 # OS version - property :modules, Text # JSON stringyfied representation of the JSON rule for further parsing - property :execution_order, Text # command module execution order - property :execution_delay, Text # command module time delays - property :chain_mode, String, :length => 40 # rule chaining mode - - has n, :executions - end - end - end - end -end diff --git a/core/main/models/execution.rb b/core/main/models/execution.rb new file mode 100644 index 0000000000..38f361b3d8 --- /dev/null +++ b/core/main/models/execution.rb @@ -0,0 +1,14 @@ +# +# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# + +module BeEF + module Core + module Models # @note Stored info about the execution of the ARE on hooked browsers. + class Execution < BeEF::Core::Model + end + end + end +end diff --git a/core/main/models/rule.rb b/core/main/models/rule.rb new file mode 100644 index 0000000000..b6f7030faf --- /dev/null +++ b/core/main/models/rule.rb @@ -0,0 +1,16 @@ +# +# Copyright (c) 2006-2019 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# + +module BeEF + module Core + module Models + # @note Table stores the rules for the Distributed Engine. + class Rule < BeEF::Core::Model + has_many :executions + end + end + end +end