Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/core/module/options.rb
Views: 11784
# Register, deregister, and validate {#options}.1module Msf::Module::Options2#3# Attributes4#56# @attribute [r] options7# The module-specific options.8attr_reader :options910#11# Instance Methods12#1314#15# This method ensures that the options associated with this module all16# have valid values according to each required option in the option17# container.18#19def validate20self.options.validate(self.datastore)21end2223protected2425#26# Removes the supplied options from the module's option container27# and data store.28#29def deregister_options(*names)30names.each { |name|31real_name = self.datastore.find_key_case(name)32if self.datastore.is_a?(Msf::DataStoreWithFallbacks)33self.datastore.remove_option(name)34else35self.datastore.delete(name)36end37self.options.remove_option(name)38if real_name != name39self.options.remove_option(real_name)40end41}42end4344attr_writer :options4546#47# Register advanced options with a specific owning class.48#49def register_advanced_options(options, owner = self.class)50self.options.add_advanced_options(options, owner)51import_defaults(false)52end5354#55# Register evasion options with a specific owning class.56#57def register_evasion_options(options, owner = self.class)58self.options.add_evasion_options(options, owner)59import_defaults(false)60end6162#63# Register options with a specific owning class.64#65def register_options(options, owner = self.class)66self.options.add_options(options, owner)67import_defaults(false)68end6970# Registers a new option group, merging options by default71#72# @param name [String] Name for the group73# @param description [String] Description of the group74# @param option_names [Array<String>] List of datastore option names75# @param required_options [Array<String>] List of required datastore option names76# @param merge [Boolean] whether to merge or overwrite the groups option names77def register_option_group(name:, description:, option_names: [], required_options: [], merge: true)78existing_group = options.groups[name]79if merge && existing_group80existing_group.description = description81existing_group.add_options(option_names)82else83option_group = Msf::OptionGroup.new(name: name,84description: description,85option_names: option_names,86required_options: required_options)87options.add_group(option_group)88end89end9091# De-registers an option group by name92#93# @param name [String] Name for the group94def deregister_option_group(name:)95options.remove_group(name)96end97end9899100