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


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

def actions
  @actions
end

#default_actionObject

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


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

def default_action
  @default_action
end

#passiveObject

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


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

def passive
  @passive
end

#passive_actionsObject

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


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

def passive_actions
  @passive_actions
end

Instance Method Details

#actionObject


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

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

#find_action(name) ⇒ Object


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

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

#initialize(info = {}) ⇒ Object


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

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


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

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


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

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