Pass workspace when using db_nmap
parent
3b1e3a4256
commit
ecbbf1d940
|
@ -124,7 +124,7 @@ class DataProxy
|
|||
end
|
||||
|
||||
def add_opts_workspace(opts)
|
||||
opts[:workspace] = workspace if opts[:workspace].nil? && opts[:wspace].nil?
|
||||
opts[:workspace] = workspace.name if opts[:workspace].nil? && opts[:wspace].nil?
|
||||
opts
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ module NmapDataProxy
|
|||
|
||||
def import_nmap_xml_file(args = {})
|
||||
begin
|
||||
data_service = self.get_data_service()
|
||||
data_service = self.get_data_service
|
||||
add_opts_workspace(args)
|
||||
data_service.import_nmap_xml_file(args)
|
||||
rescue Exception => e
|
||||
self.log_error(e, "Problem importing Nmap XML file")
|
||||
|
|
|
@ -20,6 +20,7 @@ module RemoteWorkspaceDataService
|
|||
# The @current_workspace is tracked on the client side, so attempting to call it directly from the RemoteDataService
|
||||
# will not return the correct results. Run it back through the proxy.
|
||||
wlog "[DEPRECATION] Calling workspace from within the RemoteDataService is no longer supported. Please call from WorkspaceDataProxy instead."
|
||||
caller.each { |line| wlog "#{line}"}
|
||||
framework.db.workspace
|
||||
end
|
||||
|
||||
|
@ -27,6 +28,7 @@ module RemoteWorkspaceDataService
|
|||
# The @current_workspace is tracked on the client side, so attempting to call it directly from the RemoteDataService
|
||||
# will not return the correct results. Run it back through the proxy.
|
||||
wlog "[DEPRECATION] Setting the current workspace from the RemoteDataService is no longer supported. Please call from WorkspaceDataProxy instead."
|
||||
caller.each { |line| wlog "#{line}"}
|
||||
framework.db.workspace = workspace
|
||||
end
|
||||
|
||||
|
|
|
@ -241,7 +241,6 @@ module Msf::DBManager::Import::Nmap
|
|||
#
|
||||
def import_nmap_xml_file(args={})
|
||||
filename = args[:filename]
|
||||
wspace = Msf::Util::DBManager.process_opts_workspace(args, framework)
|
||||
|
||||
data = ""
|
||||
::File.open(filename, 'rb') do |f|
|
||||
|
|
|
@ -376,12 +376,13 @@ module Rex
|
|||
reported = []
|
||||
@report_data[:ports].each do |svc|
|
||||
scripts = svc.delete(:scripts) || []
|
||||
svc_obj = db_report(:service, svc.merge(:host => host_object))
|
||||
wspace = db.workspaces({:id => host_object.workspace.id}).first
|
||||
svc_obj = db_report(:service, svc.merge(:host => host_object, :workspace => wspace.name))
|
||||
scripts.each do |script|
|
||||
script.each_pair do |k,v|
|
||||
ntype =
|
||||
nse_note = {
|
||||
:workspace => host_object.workspace,
|
||||
:workspace => wspace,
|
||||
:host => host_object,
|
||||
:service => svc_obj,
|
||||
:type => "nmap.nse.#{k}." + (svc[:proto] || "tcp") +".#{svc[:port]}",
|
||||
|
|
Loading…
Reference in New Issue