2005-07-14 06:34:58 +00:00
|
|
|
require 'msf/base'
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
module Simple
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Simple module wrapper that provides some common methods for dealing with
|
|
|
|
# modules, such as importing options and other such things.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
module Module
|
|
|
|
|
|
|
|
#
|
|
|
|
# Imports extra options from the supplied hash either as a string or as a
|
|
|
|
# hash.
|
|
|
|
#
|
|
|
|
def _import_extra_options(opts)
|
|
|
|
# If options were supplied, import them into the payload's
|
|
|
|
# datastore
|
2007-02-24 21:42:13 +00:00
|
|
|
if (opts['Options'])
|
2005-07-14 06:34:58 +00:00
|
|
|
self.datastore.import_options_from_hash(opts['Options'])
|
|
|
|
elsif (opts['OptionStr'])
|
|
|
|
self.datastore.import_options_from_s(opts['OptionStr'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-12-23 01:46:20 +00:00
|
|
|
def inspect
|
|
|
|
"#<Module:#{self.fullname} datastore=[#{self.datastore.inspect}]>"
|
|
|
|
end
|
|
|
|
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Initializes the simplified interface.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
2012-03-27 03:43:33 +00:00
|
|
|
def init_simplified(load_saved_config=true)
|
|
|
|
load_config if load_saved_config
|
2005-07-15 22:30:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Populates the datastore from the config file.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
|
|
|
def load_config
|
|
|
|
self.datastore.from_file(Msf::Config.config_file, self.refname)
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
2005-11-15 15:11:43 +00:00
|
|
|
# Saves the module's datastore to the file.
|
2005-07-15 22:30:04 +00:00
|
|
|
#
|
|
|
|
def save_config
|
|
|
|
self.datastore.to_file(Msf::Config.config_file, self.refname)
|
|
|
|
end
|
|
|
|
|
2005-07-14 06:34:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-12-23 01:46:20 +00:00
|
|
|
end
|