Module: Msf::Exploit::Remote::AutoCheck

Defined in:
lib/msf/core/exploit/auto_check.rb

Instance Method Summary collapse

Instance Method Details

#exploitObject


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/msf/core/exploit/auto_check.rb', line 15

def exploit
  unless datastore['AutoCheck']
    print_warning('AutoCheck is disabled, proceeding with exploitation')
    return super
  end

  print_status('Executing automatic check (disable AutoCheck to override)')

  warning_msg = 'ForceExploit is enabled, proceeding with exploitation.'
  error_msg = 'Enable ForceExploit to override check result.'

  case (checkcode = check)
  when Exploit::CheckCode::Vulnerable, Exploit::CheckCode::Appears
    print_good(checkcode.message)
    super
  when Exploit::CheckCode::Detected
    print_warning(checkcode.message)
    super
  when Exploit::CheckCode::Safe
    if datastore['ForceExploit']
      print_warning("#{checkcode.message} #{warning_msg}")
      return super
    end

    fail_with(Module::Failure::NotVulnerable,
              "#{checkcode.message} #{error_msg}")
  when Exploit::CheckCode::Unsupported
    if datastore['ForceExploit']
      print_warning("#{checkcode.message} #{warning_msg}")
      return super
    end

    fail_with(Module::Failure::BadConfig, "#{checkcode.message} #{error_msg}")
  else
    if datastore['ForceExploit']
      print_warning("#{checkcode.message} #{warning_msg}")
      return super
    end

    fail_with(Module::Failure::Unknown, "#{checkcode.message} #{error_msg}")
  end
end

#initialize(info = {}) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/msf/core/exploit/auto_check.rb', line 6

def initialize(info = {})
  super

  register_advanced_options([
    OptBool.new('AutoCheck', [false, 'Run check before exploitation', true]),
    OptBool.new('ForceExploit', [false, 'Override check result', false])
  ])
end