Land #6449, properly handle HttpServer resource collisions
commit
37178cda06
|
@ -162,10 +162,6 @@ module Exploit::Remote::TcpServer
|
||||||
self.service.stop
|
self.service.stop
|
||||||
end
|
end
|
||||||
|
|
||||||
if service.kind_of?(Rex::Proto::Http::Server)
|
|
||||||
service.stop
|
|
||||||
end
|
|
||||||
|
|
||||||
self.service = nil
|
self.service = nil
|
||||||
rescue ::Exception
|
rescue ::Exception
|
||||||
end
|
end
|
||||||
|
|
|
@ -187,6 +187,23 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup
|
||||||
|
# Normally service termination should not be managed on the module's level, but this is a
|
||||||
|
# special case.
|
||||||
|
#
|
||||||
|
# Originally this special service termination routine was implemented in
|
||||||
|
# Exploit::Remote::TcpServer#stop_service, but that would actually cause all HttpServers to stop
|
||||||
|
# if one of them attempts to register a resource that is already taken, which seems to be a
|
||||||
|
# harsh punishment. This is why the fix is moved here.
|
||||||
|
#
|
||||||
|
# See references:
|
||||||
|
# https://github.com/rapid7/metasploit-framework/pull/4203
|
||||||
|
# https://github.com/rapid7/metasploit-framework/issues/6445
|
||||||
|
service.stop if service
|
||||||
|
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def autofilter
|
def autofilter
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue