Path: blob/master/lib/msf/base/simple/module.rb
19591 views
# -*- coding: binary -*-12module Msf3module Simple45###6#7# Simple module wrapper that provides some common methods for dealing with8# modules, such as importing options and other such things.9#10###11module Module1213#14# Imports extra options from the supplied hash either as a string or as a15# hash.16#17def _import_extra_options(opts)18# If options were supplied, import them into the payload's19# datastore20if (value = opts['Options'])21if value.is_a?(String)22self.datastore.import_options_from_s(value)23else24self.datastore.import_options_from_hash(value)25end26elsif (value = opts['OptionStr'])27self.datastore.import_options_from_s(value)28end29end3031def inspect32"#<Module:#{self.fullname} datastore=[#{self.datastore.inspect}]>"33end3435#36# Initializes the simplified interface.37#38def init_simplified(load_saved_config=true)39load_config if load_saved_config40end4142#43# Populates the datastore from the config file.44#45def load_config46self.datastore.from_file(Msf::Config.config_file, self.refname)47end4849#50# Saves the module's datastore to the file.51#52def save_config53self.datastore.to_file(Msf::Config.config_file, self.refname)54end5556end5758end59end606162