Module: Msf::Simple::Module

Included in:
Auxiliary, Encoder, Exploit, Nop, Payload, Post
Defined in:
lib/msf/base/simple/module.rb

Overview

Simple module wrapper that provides some common methods for dealing with modules, such as importing options and other such things.

Instance Method Summary collapse

Instance Method Details

#_import_extra_options(opts) ⇒ Object

Imports extra options from the supplied hash either as a string or as a hash.


19
20
21
22
23
24
25
26
27
# File 'lib/msf/base/simple/module.rb', line 19

def _import_extra_options(opts)
  # If options were supplied, import them into the payload's
  # datastore
  if (opts['Options'])
    self.datastore.import_options_from_hash(opts['Options'])
  elsif (opts['OptionStr'])
    self.datastore.import_options_from_s(opts['OptionStr'])
  end
end

#init_simplified(load_saved_config = true) ⇒ Object

Initializes the simplified interface.


36
37
38
# File 'lib/msf/base/simple/module.rb', line 36

def init_simplified(load_saved_config=true)
  load_config if load_saved_config
end

#inspectObject


29
30
31
# File 'lib/msf/base/simple/module.rb', line 29

def inspect
  "#<Module:#{self.fullname} datastore=[#{self.datastore.inspect}]>"
end

#load_configObject

Populates the datastore from the config file.


43
44
45
# File 'lib/msf/base/simple/module.rb', line 43

def load_config
  self.datastore.from_file(Msf::Config.config_file, self.refname)
end

#save_configObject

Saves the module's datastore to the file.


50
51
52
# File 'lib/msf/base/simple/module.rb', line 50

def save_config
  self.datastore.to_file(Msf::Config.config_file, self.refname)
end