I just shaved off 8 seconds, oh yeah

bug/bundler_fix
wchen-r7 2015-04-30 00:32:33 -05:00
parent 62e3f5e56a
commit 35f564d03e
2 changed files with 19 additions and 36 deletions

View File

@ -35,47 +35,21 @@ module Msf
# Returns all the found exploit modules that support BrowserExploitServer by going through all # Returns all the found exploit modules that support BrowserExploitServer by going through all
# the exploits from the framework object. # the exploits from the framework object.
# #
# @note This method is using framework.exploits and it's one of the reasons why it's so slow,
# and will only get slower.
# @todo Maybe look for a different way to get a list of exploits.
# @return [Array] A collection of BES modules in this format: [module_fullname, Class].
def init_exploit_paths
framework.exploits.find_all do |m|
next if !m.first.include?('browser') || m.last == "__SYMBOLIC__" || m.last.fullname == self.fullname
m.last.ancestors.include? Msf::Exploit::Remote::BrowserExploitServer
end
end
# Initializes the @bap_exploits instance variable with all the found BAP exploits.
#
# @note The more BES exploits, the slower this gets.
# @see #bap_exploits The read-only attribute.
# @return [void] # @return [void]
def init_exploits def init_exploits
# Initialized BES modules are held here # First we're going to avoid using #find_all because that gets very slow.
@bap_exploits = [] framework.exploits.each_pair do |fullname, plader_holder|
next if !fullname.include?('browser') || self.fullname == "exploit/#{fullname}"
init_exploit_paths.each do |m| mod = framework.exploits.create(fullname)
module_name = m.first unless mod
xploit = framework.exploits.create(module_name) print_status("Failed to load: #{fullname}")
unless xploit
print_status("Failed to load: #{name}")
next next
end end
set_exploit_options(xploit) if mod.methods.include?(:is_browser_exploit_server?)
@bap_exploits << xploit set_exploit_options(mod)
@bap_exploits << mod
end end
end end
# Prints BAP module names
#
# @return [void]
def list_bap_names
bap_exploits.each do |m|
print_status(m.fullname)
end
end end
@ -298,6 +272,7 @@ module Msf
t1 = Time.now t1 = Time.now
self.datastore['MODULEOWNER'] = 'BAP' self.datastore['MODULEOWNER'] = 'BAP'
super super
@bap_exploits = []
print_status("Searching BES exploits, please wait...") print_status("Searching BES exploits, please wait...")
init_exploits init_exploits

View File

@ -111,6 +111,14 @@ module Msf
end end
# This allows BrowserAutoPwn's loader to identify which browser exploits are using BES, and
# which ones aren't. This is a way to get around the expensive #find_all in order to retrieve
# the #ancestors information.
def is_browser_exploit_server?
true
end
# Returns the custom 404 URL set by the user # Returns the custom 404 URL set by the user
# #
# @return [String] # @return [String]