Module: Msf::Simple::Module

Included in:
Auxiliary, Encoder, Evasion, 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.



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

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.



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

def init_simplified(load_saved_config=true)
  load_config if load_saved_config
end

#inspectObject



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

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

#load_configObject

Populates the datastore from the config file.



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

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

#save_configObject

Saves the module's datastore to the file.



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

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