Extract Msf::DBManager::ExploitedHost

MSP-11124

Extract methods related to `Mdm::ExploitedHost`s.
bug/bundler_fix
Luke Imhoff 2014-10-09 12:54:04 -05:00
parent 3ec93dea43
commit d18dcf5961
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
2 changed files with 18 additions and 17 deletions

View File

@ -76,6 +76,7 @@ class DBManager
extend Metasploit::Framework::Require extend Metasploit::Framework::Require
autoload :Cred, 'msf/core/db_manager/cred' autoload :Cred, 'msf/core/db_manager/cred'
autoload :ExploitedHost, 'msf/core/db_manager/exploited_host'
autoload :Host, 'msf/core/db_manager/host' autoload :Host, 'msf/core/db_manager/host'
autoload :IPAddress, 'msf/core/db_manager/ip_address' autoload :IPAddress, 'msf/core/db_manager/ip_address'
autoload :ModuleCache, 'msf/core/db_manager/module_cache' autoload :ModuleCache, 'msf/core/db_manager/module_cache'
@ -87,6 +88,7 @@ class DBManager
optionally_include_metasploit_credential_creation optionally_include_metasploit_credential_creation
include Msf::DBManager::Cred include Msf::DBManager::Cred
include Msf::DBManager::ExploitedHost
include Msf::DBManager::Host include Msf::DBManager::Host
include Msf::DBManager::ImportMsfXml include Msf::DBManager::ImportMsfXml
include Msf::DBManager::IPAddress include Msf::DBManager::IPAddress
@ -981,15 +983,6 @@ class DBManager
} }
end end
#
# This method returns a list of all exploited hosts in the database.
#
def exploited_hosts(wspace=workspace)
::ActiveRecord::Base.connection_pool.with_connection {
wspace.exploited_hosts
}
end
# #
# This method iterates the notes table calling the supplied block with the # This method iterates the notes table calling the supplied block with the
# note instance of each entry. # note instance of each entry.
@ -1193,14 +1186,6 @@ class DBManager
} }
end end
def each_exploited_host(wspace=workspace,&block)
::ActiveRecord::Base.connection_pool.with_connection {
wspace.exploited_hosts.each do |eh|
block.call(eh)
end
}
end
# #
# Find or create a vuln matching this service/name # Find or create a vuln matching this service/name
# #

View File

@ -0,0 +1,16 @@
module Msf::DBManager::ExploitedHost
def each_exploited_host(wspace=workspace,&block)
::ActiveRecord::Base.connection_pool.with_connection {
wspace.exploited_hosts.each do |eh|
block.call(eh)
end
}
end
# This method returns a list of all exploited hosts in the database.
def exploited_hosts(wspace=workspace)
::ActiveRecord::Base.connection_pool.with_connection {
wspace.exploited_hosts
}
end
end