47 lines
1.1 KiB
Ruby
47 lines
1.1 KiB
Ruby
|
|
# -*- coding: binary -*-
|
||
|
|
|
||
|
|
#
|
||
|
|
# XXX: This is a VERY ROUGH mixin for automatic check (formerly ForceExploit)
|
||
|
|
#
|
||
|
|
|
||
|
|
module Msf
|
||
|
|
module Exploit::Remote::AutoCheck
|
||
|
|
|
||
|
|
def initialize(info = {})
|
||
|
|
super
|
||
|
|
|
||
|
|
register_advanced_options([
|
||
|
|
OptBool.new('AutoCheck', [false, 'Run check before exploitation', true])
|
||
|
|
])
|
||
|
|
end
|
||
|
|
|
||
|
|
def exploit
|
||
|
|
unless datastore['AutoCheck']
|
||
|
|
print_warning('AutoCheck is disabled. Proceeding with exploitation.')
|
||
|
|
return
|
||
|
|
end
|
||
|
|
|
||
|
|
print_status('Executing automatic check (disable AutoCheck to override)')
|
||
|
|
|
||
|
|
checkcode = check
|
||
|
|
|
||
|
|
checkcode_error = checkcode.message + '. Disable AutoCheck to override.'
|
||
|
|
|
||
|
|
# This isn't even my final form!
|
||
|
|
case checkcode
|
||
|
|
when Exploit::CheckCode::Vulnerable, Exploit::CheckCode::Appears
|
||
|
|
print_good(checkcode.message)
|
||
|
|
when Exploit::CheckCode::Detected
|
||
|
|
print_warning(checkcode.message)
|
||
|
|
when Exploit::CheckCode::Safe
|
||
|
|
fail_with(Module::Failure::NotVulnerable, checkcode_error)
|
||
|
|
when Exploit::CheckCode::Unsupported
|
||
|
|
fail_with(Module::Failure::BadConfig, checkcode_error)
|
||
|
|
else
|
||
|
|
fail_with(Module::Failure::Unknown, checkcode_error)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
end
|