# -*- 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)') # This isn't even my final form! case (checkcode = check) 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.message}. Disable AutoCheck to override.") when Exploit::CheckCode::Unsupported fail_with(Module::Failure::BadConfig, "#{checkcode.message}. Disable AutoCheck to override.") else fail_with(Module::Failure::Unknown, "#{checkcode.message}. Disable AutoCheck to override.") end end end end