Initial commit for nmap proxying

GSoC/Meterpreter_Web_Console
James Barnett 2017-10-25 16:04:31 -05:00
parent d63b087610
commit 9d00093d81
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
6 changed files with 52 additions and 0 deletions

View File

@ -15,6 +15,7 @@ module DataProxyAutoLoader
autoload :LootDataProxy, 'metasploit/framework/data_service/proxy/loot_data_proxy'
autoload :SessionEventDataProxy, 'metasploit/framework/data_service/proxy/session_event_data_proxy'
autoload :CredentialDataProxy, 'metasploit/framework/data_service/proxy/credential_data_proxy'
autoload :NmapDataProxy, 'metasploit/framework/data_service/proxy/nmap_data_proxy'
include ServiceDataProxy
include HostDataProxy
include VulnDataProxy

View File

@ -0,0 +1,12 @@
module NmapDataProxy
def import_nmap_xml_file(args = {})
begin
data_service = self.get_data_service()
data_service.import_nmap_xml_file(args)
rescue Exception => e
puts "Call to #{data_service.class}#import_nmap_xml_file threw exception: #{e.message}"
e.backtrace { |line| puts "#{line}\n"}
end
end
end

View File

@ -14,6 +14,7 @@ module DataServiceAutoLoader
autoload :RemoteLootDataService, 'metasploit/framework/data_service/remote/http/remote_loot_data_service'
autoload :RemoteSessionEventDataService, 'metasploit/framework/data_service/remote/http/remote_session_event_data_service'
autoload :RemoteCredentialDataService, 'metasploit/framework/data_service/remote/http/remote_credential_data_service'
autoload :RemoteNmapDataService, 'metasploit/framework/data_service/remote/http/remote_nmap_data_service'
include RemoteHostDataService
include RemoteEventDataService
include RemoteNoteDataService
@ -26,4 +27,5 @@ module DataServiceAutoLoader
include RemoteLootDataService
include RemoteSessionEventDataService
include RemoteCredentialDataService
include RemoteNmapDataService
end

View File

@ -0,0 +1,11 @@
require 'metasploit/framework/data_service/remote/http/response_data_helper'
module RemoteLootDataService
include ResponseDataHelper
NMAP_PATH = '/api/1/msf/nmap'
def import_nmap_xml_file(args)
self.post_data_async(NMAP_PATH, args)
end
end

View File

@ -0,0 +1,24 @@
module nmapServlet
def self.api_path
'/api/1/msf/nmap'
end
def self.registered(app)
app.post nmapServlet.api_path, &import_nmap_xml_file
end
#######
private
#######
def self.import_nmap_xml_file
lambda {
job = lambda { |opts|
get_db().import_nmap_xml_file(opts)
}
exec_report_job(request, &job)
}
end
end

View File

@ -14,6 +14,7 @@ require 'msf/core/db_manager/http/servlet/exploit_servlet'
require 'msf/core/db_manager/http/servlet/loot_servlet'
require 'msf/core/db_manager/http/servlet/session_event_servlet'
require 'msf/core/db_manager/http/servlet/credential_servlet'
require 'msf/core/db_manager/http/servlet/nmap_servlet'
class SinatraApp < Sinatra::Base
@ -35,4 +36,5 @@ class SinatraApp < Sinatra::Base
register LootServlet
register SessionEventServlet
register CredentialServlet
register NmapServlet
end