Class: Mdm::Module::Detail
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- 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', 'evasion' => 'evasion' }
- 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.
54 |
# File 'app/models/mdm/module/detail.rb', line 54 has_many :actions, :class_name => 'Mdm::Module::Action', :dependent => :destroy |
#archs ⇒ ActiveRecord::Relation<Mdm::Module::Arch>
Architectures supported by this module.
60 |
# File 'app/models/mdm/module/detail.rb', line 60 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.
67 |
# File 'app/models/mdm/module/detail.rb', line 67 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 117
|
#default_target ⇒ String
Name of the default target in #targets.
|
# File 'app/models/mdm/module/detail.rb', line 122
|
#description ⇒ String
A long, paragraph description of what the module does.
|
# File 'app/models/mdm/module/detail.rb', line 127
|
#disclosure_date ⇒ DateTime
The date the vulnerability exploited by this module was disclosed to the public.
|
# File 'app/models/mdm/module/detail.rb', line 132
|
#file ⇒ String
The full path to the module file on-disk.
|
# File 'app/models/mdm/module/detail.rb', line 137
|
#fullname ⇒ String
|
# File 'app/models/mdm/module/detail.rb', line 142
|
#license ⇒ String
The name of the software license for the module's code.
|
# File 'app/models/mdm/module/detail.rb', line 147
|
#matches ⇒ ActiveRecord::Relation<MetasploitDataModels::AutomaticExploitation::Match>
Matches for this module
73 74 75 76 77 |
# File 'app/models/mdm/module/detail.rb', line 73 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.
83 |
# File 'app/models/mdm/module/detail.rb', line 83 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
89 90 91 92 93 |
# File 'app/models/mdm/module/detail.rb', line 89 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 152
|
#mtype ⇒ String
The type of the module.
|
# File 'app/models/mdm/module/detail.rb', line 157
|
#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 162
|
#platforms ⇒ ActiveRecord::Relation<Mdm::Module::Platform>
Platforms supported by this module.
99 |
# File 'app/models/mdm/module/detail.rb', line 99 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 168
|
#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 173
|
#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 179
|
#refname ⇒ String
The reference name of the module.
|
# File 'app/models/mdm/module/detail.rb', line 185
|
#refs ⇒ ActiveRecord::Relation<Mdm::Module::Ref>
External references to the vulnerabilities this module exploits.
105 |
# File 'app/models/mdm/module/detail.rb', line 105 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 190
|
#targets ⇒ ActiveRecord::Relation<Mdm::Module::Target>
Names of targets with different configurations that can be exploited by this module.
111 |
# File 'app/models/mdm/module/detail.rb', line 111 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.
304 305 306 |
# File 'app/models/mdm/module/detail.rb', line 304 def add_action(name) self.actions.build(:name => name).save end |
#add_arch(name) ⇒ true, false
314 315 316 |
# File 'app/models/mdm/module/detail.rb', line 314 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.
325 326 327 |
# File 'app/models/mdm/module/detail.rb', line 325 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.
335 336 337 |
# File 'app/models/mdm/module/detail.rb', line 335 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.
345 346 347 |
# File 'app/models/mdm/module/detail.rb', line 345 def add_platform(name) self.platforms.build(:name => name).save end |
#add_ref(name) ⇒ true, false
355 356 357 |
# File 'app/models/mdm/module/detail.rb', line 355 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.
366 367 368 |
# File 'app/models/mdm/module/detail.rb', line 366 def add_target(index, name) self.targets.build(:index => index, :name => name).save end |
#supports_stance? ⇒ true, false
377 378 379 380 381 382 383 384 385 |
# File 'app/models/mdm/module/detail.rb', line 377 def supports_stance? supports_stance = false if ['auxiliary', 'exploit'].include? mtype supports_stance = true end supports_stance end |