Module: Msf::Module::Options
- Included in:
- Msf::Module
- Defined in:
- lib/msf/core/module/options.rb
Overview
Register, deregister, and validate #options.
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#deregister_option_group(name:) ⇒ Object
protected
De-registers an option group by name.
-
#deregister_options(*names) ⇒ Object
protected
Removes the supplied options from the module’s option container and data store.
-
#register_advanced_options(options, owner = self.class) ⇒ Object
protected
Register advanced options with a specific owning class.
-
#register_evasion_options(options, owner = self.class) ⇒ Object
protected
Register evasion options with a specific owning class.
-
#register_option_group(name:, description:, option_names: [], required_options: [], merge: true) ⇒ Object
protected
Registers a new option group, merging options by default.
-
#register_options(options, owner = self.class) ⇒ Object
protected
Register options with a specific owning class.
-
#validate ⇒ Object
This method ensures that the options associated with this module all have valid values according to each required option in the option container.
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/msf/core/module/options.rb', line 9 def @options end |
Instance Method Details
#deregister_option_group(name:) ⇒ Object (protected)
De-registers an option group by name
95 96 97 |
# File 'lib/msf/core/module/options.rb', line 95 def deregister_option_group(name:) .remove_group(name) end |
#deregister_options(*names) ⇒ Object (protected)
Removes the supplied options from the module’s option container and data store.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/msf/core/module/options.rb', line 30 def (*names) names.each { |name| real_name = self.datastore.find_key_case(name) if self.datastore.is_a?(Msf::DataStoreWithFallbacks) self.datastore.remove_option(name) else self.datastore.delete(name) end self..remove_option(name) if real_name != name self..remove_option(real_name) end } end |
#register_advanced_options(options, owner = self.class) ⇒ Object (protected)
Register advanced options with a specific owning class.
50 51 52 53 |
# File 'lib/msf/core/module/options.rb', line 50 def (, owner = self.class) self..(, owner) import_defaults(false) end |
#register_evasion_options(options, owner = self.class) ⇒ Object (protected)
Register evasion options with a specific owning class.
58 59 60 61 |
# File 'lib/msf/core/module/options.rb', line 58 def (, owner = self.class) self..(, owner) import_defaults(false) end |
#register_option_group(name:, description:, option_names: [], required_options: [], merge: true) ⇒ Object (protected)
Registers a new option group, merging options by default
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/msf/core/module/options.rb', line 78 def register_option_group(name:, description:, option_names: [], required_options: [], merge: true) existing_group = .groups[name] if merge && existing_group existing_group.description = description existing_group.(option_names) else option_group = Msf::OptionGroup.new(name: name, description: description, option_names: option_names, required_options: ) .add_group(option_group) end end |
#register_options(options, owner = self.class) ⇒ Object (protected)
Register options with a specific owning class.
66 67 68 69 |
# File 'lib/msf/core/module/options.rb', line 66 def (, owner = self.class) self..(, owner) import_defaults(false) end |
#validate ⇒ Object
This method ensures that the options associated with this module all have valid values according to each required option in the option container.
20 21 22 |
# File 'lib/msf/core/module/options.rb', line 20 def validate self..validate(self.datastore) end |