Module: Msf::Module::DataStore

Included in:
Msf::Module
Defined in:
lib/msf/core/module/data_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datastoreObject

Returns the value of attribute datastore


10
11
12
# File 'lib/msf/core/module/data_store.rb', line 10

def datastore
  @datastore
end

Instance Method Details

#import_defaults(clear_datastore = true) ⇒ Object

Imports default options into the module's datastore, optionally clearing all of the values currently set in the datastore.


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/msf/core/module/data_store.rb', line 16

def import_defaults(clear_datastore = true)
  # Clear the datastore if the caller asked us to
  self.datastore.clear if clear_datastore

  self.datastore.import_options(self.options, 'self', true)

  # If there are default options, import their values into the datastore
  if (module_info['DefaultOptions'])
    self.datastore.import_options_from_hash(module_info['DefaultOptions'], true, 'self')
  end
end

#import_target_defaultsObject

Import the target's DefaultOptions hash into the datastore.


31
32
33
34
35
# File 'lib/msf/core/module/data_store.rb', line 31

def import_target_defaults
  return unless target && target.default_options

  datastore.import_options_from_hash(target.default_options, true, 'self')
end

#share_datastore(ds) ⇒ Object

Overrides the class' own datastore with the one supplied. This is used to allow modules to share datastores, such as a payload sharing an exploit module's datastore.


42
43
44
45
# File 'lib/msf/core/module/data_store.rb', line 42

def share_datastore(ds)
  self.datastore = ds
  self.datastore.import_options(self.options)
end