Class: Mdm::Module::Detail
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Mdm::Module::Detail
- Defined in:
- app/models/mdm/module/detail.rb
Overview
Details about an Msf::Module. Metadata that can be an array is stored in associations in modules under the Mdm::Module namespace.
Constant Summary collapse
- DIRECTORY_BY_TYPE =
{ 'auxiliary' => 'auxiliary', 'encoder' => 'encoders', 'exploit' => 'exploits', 'nop' => 'nops', 'payload' => 'payloads', 'post' => 'post' }
- PRIVILEGES =
#privileged is Boolean so, valid values are just
true
andfalse
, but since both the validation and factory need an array of valid values, this constant exists. [ false, true ]
- RANK_BY_NAME =
Converts #rank, which is an Integer, to the name used for that rank.
{ 'Manual' => 0, 'Low' => 100, 'Average' => 200, 'Normal' => 300, 'Good' => 400, 'Great' => 500, 'Excellent' => 600 }
- STANCES =
Valid values for #stance.
[ 'aggressive', 'passive' ]
Instance Attribute Summary collapse
-
#actions ⇒ ActiveRecord::Relation<Mdm::Module::Action>
Auxiliary actions to perform when this running this module.
-
#archs ⇒ ActiveRecord::Relation<Mdm::Module::Arch>
Architectures supported by this module.
-
#authors ⇒ ActiveRecord::Relation<Mdm::Module::Mixin>
Authors (and their emails) of this module.
-
#default_action ⇒ String
Name of the default action in #actions.
-
#default_target ⇒ String
Name of the default target in #targets.
-
#description ⇒ String
A long, paragraph description of what the module does.
-
#disclosure_date ⇒ DateTime
The date the vulnerability exploited by this module was disclosed to the public.
-
#file ⇒ String
The full path to the module file on-disk.
-
#fullname ⇒ String
The full name of the module.
-
#license ⇒ String
The name of the software license for the module's code.
-
#matches ⇒ ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>
Matches for this module.
-
#mixins ⇒ ActiveRecord::Relation<Mdm::Module::Mixin>
Mixins used by this module.
-
#module_runs ⇒ ActiveRecord::Relation<MetasploitDataModels::ModuleRun>
Records of times when this module has been used.
-
#mtime ⇒ DateTime
The modification time of the module file on-disk.
-
#mtype ⇒ String
The type of the module.
-
#name ⇒ String
The human readable name of the module.
-
#platforms ⇒ ActiveRecord::Relation<Mdm::Module::Platform>
Platforms supported by this module.
-
#privileged ⇒ Boolean
Whether this module requires priveleged access to run.
-
#rank ⇒ Integer
The reliability of the module and likelyhood that the module won't knock over the service or host being exploited.
-
#ready ⇒ false, true
Boolean indicating whether the metadata for the module has been updated from the on-disk module.
-
#refname ⇒ String
The reference name of the module.
-
#refs ⇒ ActiveRecord::Relation<Mdm::Module::Ref>
External references to the vulnerabilities this module exploits.
-
#stance ⇒ 'active', ...
Whether the module is active or passive.
-
#targets ⇒ ActiveRecord::Relation<Mdm::Module::Target>
Names of targets with different configurations that can be exploited by this module.
Instance Method Summary collapse
-
#add_action(name) ⇒ true, false
Adds an Action with the given Action#name to #actions and immediately saves it to the database.
- #add_arch(name) ⇒ true, false
-
#add_author(name, email = nil) ⇒ true, false
Adds an Author with the given Author#name and Author#email to #authors and immediately saves it to the database.
-
#add_mixin(name) ⇒ true, false
Adds an Mixin with the given Mixin#name to #mixins and immediately saves it to the database.
-
#add_platform(name) ⇒ true, false
Adds an Platform with the given Platform#name to #platforms and immediately saves it to the database.
- #add_ref(name) ⇒ true, false
-
#add_target(index, name) ⇒ true, false
Adds an Target with the given Target#index and Target#name to #targets and immediately saves it to the database.
-
#supports_stance? ⇒ true, false
Returns whether this module supports a #stance.
Instance Attribute Details
#actions ⇒ ActiveRecord::Relation<Mdm::Module::Action>
Auxiliary actions to perform when this running this module.
53 |
# File 'app/models/mdm/module/detail.rb', line 53 has_many :actions, :class_name => 'Mdm::Module::Action', :dependent => :destroy |
#archs ⇒ ActiveRecord::Relation<Mdm::Module::Arch>
Architectures supported by this module.
59 |
# File 'app/models/mdm/module/detail.rb', line 59 has_many :archs, :class_name => 'Mdm::Module::Arch', :dependent => :destroy |
#authors ⇒ ActiveRecord::Relation<Mdm::Module::Mixin>
Authors (and their emails) of this module. Usually includes the original discoverer who wrote the proof-of-concept and then the people that ported the proof-of-concept to metasploit-framework.
66 |
# File 'app/models/mdm/module/detail.rb', line 66 has_many :authors, :class_name => 'Mdm::Module::Author', :dependent => :destroy |
#default_action ⇒ String
Name of the default action in #actions.
|
# File 'app/models/mdm/module/detail.rb', line 116
|
#default_target ⇒ String
Name of the default target in #targets.
|
# File 'app/models/mdm/module/detail.rb', line 121
|
#description ⇒ String
A long, paragraph description of what the module does.
|
# File 'app/models/mdm/module/detail.rb', line 126
|
#disclosure_date ⇒ DateTime
The date the vulnerability exploited by this module was disclosed to the public.
|
# File 'app/models/mdm/module/detail.rb', line 131
|
#file ⇒ String
The full path to the module file on-disk.
|
# File 'app/models/mdm/module/detail.rb', line 136
|
#fullname ⇒ String
|
# File 'app/models/mdm/module/detail.rb', line 141
|
#license ⇒ String
The name of the software license for the module's code.
|
# File 'app/models/mdm/module/detail.rb', line 146
|
#matches ⇒ ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>
Matches for this module
72 73 74 75 76 |
# File 'app/models/mdm/module/detail.rb', line 72 has_many :matches, :class_name => 'MetasploitDataModels::AutomaticExploitation::Match', :primary_key => :fullname, :foreign_key => :module_fullname, :inverse_of => :module_detail |
#mixins ⇒ ActiveRecord::Relation<Mdm::Module::Mixin>
Mixins used by this module.
82 |
# File 'app/models/mdm/module/detail.rb', line 82 has_many :mixins, :class_name => 'Mdm::Module::Mixin', :dependent => :destroy |
#module_runs ⇒ ActiveRecord::Relation<MetasploitDataModels::ModuleRun>
Records of times when this module has been used
88 89 90 91 92 |
# File 'app/models/mdm/module/detail.rb', line 88 has_many :module_runs, :class_name => 'MetasploitDataModels::ModuleRun', :primary_key => :fullname, :foreign_key => :module_fullname, :inverse_of => :module_detail |
#mtime ⇒ DateTime
The modification time of the module file on-disk.
|
# File 'app/models/mdm/module/detail.rb', line 151
|
#mtype ⇒ String
The type of the module.
|
# File 'app/models/mdm/module/detail.rb', line 156
|
#name ⇒ String
The human readable name of the module. It is unrelated to #fullname or #refname and is better thought of as a short summary of the #description.
|
# File 'app/models/mdm/module/detail.rb', line 161
|
#platforms ⇒ ActiveRecord::Relation<Mdm::Module::Platform>
Platforms supported by this module.
98 |
# File 'app/models/mdm/module/detail.rb', line 98 has_many :platforms, :class_name => 'Mdm::Module::Platform', :dependent => :destroy |
#privileged ⇒ Boolean
Whether this module requires priveleged access to run.
|
# File 'app/models/mdm/module/detail.rb', line 167
|
#rank ⇒ Integer
The reliability of the module and likelyhood that the module won't knock over the service or host being exploited. Bigger values is better.
|
# File 'app/models/mdm/module/detail.rb', line 172
|
#ready ⇒ false, true
Boolean indicating whether the metadata for the module has been updated from the on-disk module.
|
# File 'app/models/mdm/module/detail.rb', line 178
|
#refname ⇒ String
The reference name of the module.
|
# File 'app/models/mdm/module/detail.rb', line 184
|
#refs ⇒ ActiveRecord::Relation<Mdm::Module::Ref>
External references to the vulnerabilities this module exploits.
104 |
# File 'app/models/mdm/module/detail.rb', line 104 has_many :refs, :class_name => 'Mdm::Module::Ref', :dependent => :destroy |
#stance ⇒ 'active', ...
Whether the module is active or passive. nil
if the module type does not
support stances.
|
# File 'app/models/mdm/module/detail.rb', line 189
|
#targets ⇒ ActiveRecord::Relation<Mdm::Module::Target>
Names of targets with different configurations that can be exploited by this module.
110 |
# File 'app/models/mdm/module/detail.rb', line 110 has_many :targets, :class_name => 'Mdm::Module::Target', :dependent => :destroy |
Instance Method Details
#add_action(name) ⇒ true, false
Adds an Action with the given Action#name to #actions and immediately saves it to the database.
235 236 237 |
# File 'app/models/mdm/module/detail.rb', line 235 def add_action(name) self.actions.build(:name => name).save end |
#add_arch(name) ⇒ true, false
245 246 247 |
# File 'app/models/mdm/module/detail.rb', line 245 def add_arch(name) self.archs.build(:name => name).save end |
#add_author(name, email = nil) ⇒ true, false
Adds an Author with the given Author#name and Author#email to #authors and immediately saves it to the database.
256 257 258 |
# File 'app/models/mdm/module/detail.rb', line 256 def (name, email=nil) self..build(:name => name, :email => email).save end |
#add_mixin(name) ⇒ true, false
Adds an Mixin with the given Mixin#name to #mixins and immediately saves it to the database.
266 267 268 |
# File 'app/models/mdm/module/detail.rb', line 266 def add_mixin(name) self.mixins.build(:name => name).save end |
#add_platform(name) ⇒ true, false
Adds an Platform with the given Platform#name to #platforms and immediately saves it to the database.
276 277 278 |
# File 'app/models/mdm/module/detail.rb', line 276 def add_platform(name) self.platforms.build(:name => name).save end |
#add_ref(name) ⇒ true, false
286 287 288 |
# File 'app/models/mdm/module/detail.rb', line 286 def add_ref(name) self.refs.build(:name => name).save end |
#add_target(index, name) ⇒ true, false
Adds an Target with the given Target#index and Target#name to #targets and immediately saves it to the database.
297 298 299 |
# File 'app/models/mdm/module/detail.rb', line 297 def add_target(index, name) self.targets.build(:index => index, :name => name).save end |
#supports_stance? ⇒ true, false
308 309 310 311 312 313 314 315 316 |
# File 'app/models/mdm/module/detail.rb', line 308 def supports_stance? supports_stance = false if ['auxiliary', 'exploit'].include? mtype supports_stance = true end supports_stance end |