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
27
28
29
30
# 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 (value = opts['Options'])
    if value.is_a?(String)
      self.datastore.import_options_from_s(value)
    else
      self.datastore.import_options_from_hash(value)
    end
  elsif (value = opts['OptionStr'])
    self.datastore.import_options_from_s(value)
  end
end

#init_simplified(load_saved_config = true) ⇒ Object

Initializes the simplified interface.



39
40
41
# File 'lib/msf/base/simple/module.rb', line 39

def init_simplified(load_saved_config=true)
  load_config if load_saved_config
end

#inspectObject



32
33
34
# File 'lib/msf/base/simple/module.rb', line 32

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

#load_configObject

Populates the datastore from the config file.



46
47
48
# File 'lib/msf/base/simple/module.rb', line 46

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

#save_configObject

Saves the module’s datastore to the file.



53
54
55
# File 'lib/msf/base/simple/module.rb', line 53

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