Module: Msf::Module::HasActions

Included in:
PostMixin
Defined in:
lib/msf/core/module/has_actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionsObject

Allow access to the hash table of actions and the string containing the default action



50
51
52
# File 'lib/msf/core/module/has_actions.rb', line 50

def actions
  @actions
end

#default_actionObject

Allow access to the hash table of actions and the string containing the default action



50
51
52
# File 'lib/msf/core/module/has_actions.rb', line 50

def default_action
  @default_action
end

#passiveObject

Allow access to the hash table of actions and the string containing the default action



50
51
52
# File 'lib/msf/core/module/has_actions.rb', line 50

def passive
  @passive
end

#passive_actionsObject

Allow access to the hash table of actions and the string containing the default action



50
51
52
# File 'lib/msf/core/module/has_actions.rb', line 50

def passive_actions
  @passive_actions
end

Instance Method Details

#actionObject



16
17
18
19
20
# File 'lib/msf/core/module/has_actions.rb', line 16

def action
  sa = datastore['ACTION']
  return find_action(default_action) if not sa
  return find_action(sa)
end

#find_action(name) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/msf/core/module/has_actions.rb', line 22

def find_action(name)
  return nil if not name
  actions.each do |a|
    return a if a.name.downcase == name.downcase
  end
  return nil
end

#initialize(info = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/msf/core/module/has_actions.rb', line 4

def initialize(info={})
  super
  self.actions = Rex::Transformer.transform(
    info['Actions'], Array,
    [ Msf::Module::AuxiliaryAction ], 'AuxiliaryAction'
  )

  self.passive = (info['Passive'] and info['Passive'] == true) || false
  self.default_action = info['DefaultAction']
  self.passive_actions = info['PassiveActions'] || []
end

#passive?Boolean

Returns a boolean indicating whether this module should be run passively

Returns:

  • (Boolean)


33
34
35
36
37
# File 'lib/msf/core/module/has_actions.rb', line 33

def passive?
  act = action()
  return passive_action?(act.name) if act
  return self.passive
end

#passive_action?(name) ⇒ Boolean

Returns a boolean indicating whether this specific action should be run passively

Returns:

  • (Boolean)


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

def passive_action?(name)
  passive_actions.include?(name)
end