delete old feature detection code from exploit base

This deletes some old code that apparently has been broken and somewhat unused for many years.

The 'derived_implementor?' method for modules relies on the debug output from Ruby in order to tell of a class implements a method, but the regex it used didn't work properly with any modern Ruby version until 2.5.x. This caused a random sleep to get inserted into certain payload staging operations, which actively breaks staging in certain scenarios (I'm not trying to address that here).

This also removes some ancient module feature detection code, which also is entirely unused today.
GSoC/Meterpreter_Web_Console
Brent Cook 2018-04-07 12:47:42 -05:00
parent 3aee44ca1a
commit 6fb6570f99
3 changed files with 0 additions and 53 deletions

View File

@ -597,41 +597,6 @@ class Exploit < Msf::Module
encoded encoded
end end
##
#
# Feature detection
#
# These methods check to see if there is a derived implementation of
# various methods as a way of inferring whether or not a given exploit
# supports the feature.
#
##
#
# Returns true if the exploit module supports the check method.
#
def supports_check?
derived_implementor?(Msf::Exploit, 'check')
end
#
# Returns true if the exploit module supports the exploit method.
#
def supports_exploit?
derived_implementor?(Msf::Exploit, 'exploit')
end
#
# Returns a hash of the capabilities this exploit module has support for,
# such as whether or not it supports check and exploit.
#
def capabilities
{
'check' => supports_check?,
'exploit' => supports_exploit?
}
end
## ##
# #
# Getters/Setters # Getters/Setters

View File

@ -359,15 +359,6 @@ class Module
self.module_store = {} self.module_store = {}
end end
#
# Checks to see if a derived instance of a given module implements a method
# beyond the one that is provided by a base class. This is a pretty lame
# way of doing it, but I couldn't find a better one, so meh.
#
def derived_implementor?(parent, method_name)
(self.method(method_name).to_s.match(/#{parent}[^:]/)) ? false : true
end
attr_writer :platform, :references # :nodoc: attr_writer :platform, :references # :nodoc:
attr_writer :privileged # :nodoc: attr_writer :privileged # :nodoc:
attr_writer :license # :nodoc: attr_writer :license # :nodoc:

View File

@ -215,15 +215,6 @@ module Msf::Payload::Stager
conn.put(p) conn.put(p)
end end
# If the stage implements the handle connection method, sleep before
# handling it.
if (derived_implementor?(Msf::Payload::Stager, 'handle_connection_stage'))
print_status("Sleeping before handling stage...")
# Sleep before processing the stage
Rex::ThreadSafe.sleep(1.5)
end
# Give the stages a chance to handle the connection # Give the stages a chance to handle the connection
handle_connection_stage(conn, opts) handle_connection_stage(conn, opts)
end end