Refactored models to use ActiveRecord
This commit is contained in:
@@ -11,14 +11,7 @@ module Models
|
||||
#
|
||||
# For example, the type and version of browser the hooked browsers are using.
|
||||
#
|
||||
class BrowserDetails
|
||||
|
||||
include DataMapper::Resource
|
||||
|
||||
storage_names[:default] = 'core_browserdetails'
|
||||
property :session_id, String, :length => 255, :key => true
|
||||
property :detail_key, String, :length => 255, :lazy => false, :key => true
|
||||
property :detail_value, Text, :lazy => false
|
||||
class BrowserDetails < BeEF::Core::Model
|
||||
|
||||
#
|
||||
# Returns the requested value from the data store
|
||||
|
||||
@@ -9,19 +9,9 @@ module Core
|
||||
module Models
|
||||
|
||||
# @note Table stores the commands that have been sent to the Hooked Browsers.
|
||||
class Command
|
||||
class Command < BeEF::Core::Model
|
||||
|
||||
include DataMapper::Resource
|
||||
|
||||
storage_names[:default] = 'commands'
|
||||
|
||||
property :id, Serial
|
||||
property :data, Text
|
||||
property :creationdate, String, :length => 15, :lazy => false
|
||||
property :label, Text, :lazy => false
|
||||
property :instructions_sent, Boolean, :default => false
|
||||
|
||||
has n, :results
|
||||
has_many :results
|
||||
|
||||
#
|
||||
# Save results and flag that the command has been run on the hooked browser
|
||||
|
||||
@@ -7,22 +7,10 @@ module BeEF
|
||||
module Core
|
||||
module Models
|
||||
|
||||
class CommandModule
|
||||
class CommandModule < BeEF::Core::Model
|
||||
|
||||
include DataMapper::Resource
|
||||
has_many :commands
|
||||
|
||||
storage_names[:default] = 'core_commandmodules'
|
||||
|
||||
# @note command module ID
|
||||
property :id, Serial
|
||||
|
||||
# @note command module name
|
||||
property :name, Text, :lazy => false
|
||||
|
||||
# @note command module path
|
||||
property :path, Text, :lazy => false
|
||||
|
||||
has n, :commands
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -9,45 +9,11 @@ module Models
|
||||
#
|
||||
#
|
||||
#
|
||||
class HookedBrowser
|
||||
class HookedBrowser < BeEF::Core::Model
|
||||
|
||||
include DataMapper::Resource
|
||||
|
||||
storage_names[:default] = 'core_hookedbrowsers'
|
||||
|
||||
# @note zombie ID
|
||||
property :id, Serial
|
||||
|
||||
# @note hooked browser session ID
|
||||
property :session, Text, :lazy => false
|
||||
|
||||
# @note IP address of the hooked browser
|
||||
property :ip, Text, :lazy => false
|
||||
|
||||
# @note timestamp first time the browser communicated with BeEF
|
||||
property :firstseen, String, :length => 15
|
||||
|
||||
# @note timestamp last time the browser communicated with BeEF
|
||||
property :lastseen, String, :length => 15
|
||||
|
||||
# @note HTTP headers sent be the browser to the BeEF server upon first hook
|
||||
property :httpheaders, Text, :lazy => false
|
||||
|
||||
# @note the domain originating the hook request
|
||||
property :domain, Text, :lazy => false
|
||||
|
||||
# @note the port on the domain originating the hook request
|
||||
property :port, Integer, :default => 80
|
||||
|
||||
# @note number of times the zombie has polled
|
||||
property :count, Integer, :lazy => false
|
||||
|
||||
# @note if true the HB is used as a tunneling proxy
|
||||
property :is_proxy, Boolean, :default => false
|
||||
|
||||
has n, :commands
|
||||
has n, :results
|
||||
has n, :logs
|
||||
has_many :commands
|
||||
has_many :results
|
||||
has_many :logs
|
||||
|
||||
# @note Increases the count of a zombie
|
||||
def count!
|
||||
|
||||
@@ -7,17 +7,10 @@ module BeEF
|
||||
module Core
|
||||
module Models
|
||||
|
||||
class Log
|
||||
class Log < BeEF::Core::Model
|
||||
|
||||
include DataMapper::Resource
|
||||
has_one :hooked_browser
|
||||
|
||||
storage_names[:default] = 'core_logs'
|
||||
|
||||
property :id, Serial
|
||||
property :type, Text, :lazy => false
|
||||
property :event, Text, :lazy => false
|
||||
property :date, DateTime, :lazy => false
|
||||
property :hooked_browser_id, Text, :lazy => false
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,15 +7,7 @@ module BeEF
|
||||
module Core
|
||||
module Models
|
||||
|
||||
class OptionCache
|
||||
|
||||
include DataMapper::Resource
|
||||
|
||||
storage_names[:default] = 'core_optioncache'
|
||||
|
||||
property :id, Serial
|
||||
property :name, Text
|
||||
property :value, Text
|
||||
class OptionCache < BeEF::Core::Model
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -7,16 +7,7 @@ module BeEF
|
||||
module Core
|
||||
module Models
|
||||
|
||||
class Result
|
||||
|
||||
include DataMapper::Resource
|
||||
|
||||
storage_names[:default] = 'core_results'
|
||||
|
||||
property :id, Serial
|
||||
property :date, String, :length => 15, :lazy => false
|
||||
property :status, Integer
|
||||
property :data, Text
|
||||
class Result < BeEF::Core::Model
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user