Module: Msf::Exploit::Remote::CheckModule
- Defined in:
- lib/msf/core/exploit/remote/check_module.rb
Instance Method Summary collapse
-
#check ⇒ Msf::Exploit::CheckCode
When this mixin is included, this method becomes the exploit’s check method.
- #check_module ⇒ Object
-
#check_options ⇒ Hash
Override this method to change the datastore options with which the check module is executed.
- #initialize(info = {}) ⇒ Object
Instance Method Details
#check ⇒ Msf::Exploit::CheckCode
When this mixin is included, this method becomes the exploit’s check method
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/msf/core/exploit/remote/check_module.rb', line 21 def check # Instantiate the module mod = framework.modules.create(check_module) # Bail if we couldn't unless mod return Exploit::CheckCode::Unsupported( "Could not instantiate #{check_module}." ) end # Bail if it isn't aux if mod.type != Msf::MODULE_AUX return Exploit::CheckCode::Unsupported( "#{check_module} is not an auxiliary module." ) end # Bail if run isn't defined unless mod.respond_to?(:run) return Exploit::CheckCode::Unsupported( "#{check_module} does not define a run method." ) end print_status("Using #{check_module} as check") # Retrieve the module's return value res = mod.run_simple( 'LocalInput' => user_input, 'LocalOutput' => user_output, 'Options' => datastore.merge(), 'RunAsJob' => false ) # Ensure return value is a CheckCode case res when Exploit::CheckCode # Return the CheckCode res when Hash # XXX: Find CheckCode associated with RHOST, which is set automatically checkcode = res[datastore['RHOST']] # Bail if module doesn't return a CheckCode unless checkcode.kind_of?(Exploit::CheckCode) return Exploit::CheckCode::Unsupported( "#{check_module} does not return a CheckCode." ) end # Return the CheckCode checkcode else # Bail if module doesn't return a CheckCode Exploit::CheckCode::Unsupported( "#{check_module} does not return a CheckCode." ) end end |
#check_module ⇒ Object
90 91 92 |
# File 'lib/msf/core/exploit/remote/check_module.rb', line 90 def check_module datastore['CheckModule'] end |
#check_options ⇒ Hash
Override this method to change the datastore options with which the check module is executed.
86 87 88 |
# File 'lib/msf/core/exploit/remote/check_module.rb', line 86 def {} end |