From c670748fe33d603ff554988f997d00f0eec3fad1 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Wed, 7 Mar 2018 13:59:09 -0600 Subject: [PATCH] Update services signature --- .../framework/data_service/proxy/service_data_proxy.rb | 9 +-------- lib/msf/ui/console/command_dispatcher/db.rb | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/metasploit/framework/data_service/proxy/service_data_proxy.rb b/lib/metasploit/framework/data_service/proxy/service_data_proxy.rb index 45aaa33fe8..cfe6f14d83 100644 --- a/lib/metasploit/framework/data_service/proxy/service_data_proxy.rb +++ b/lib/metasploit/framework/data_service/proxy/service_data_proxy.rb @@ -1,16 +1,9 @@ module ServiceDataProxy - def services(wspace = workspace, only_up = false, proto = nil, addresses = nil, ports = nil, names = nil, search_term = nil) + def services(wspace = workspace, opts = {}) begin data_service = self.get_data_service() - opts = {} opts[:workspace] = wspace - opts[:only_up] = only_up - opts[:proto] = proto - opts[:addresses] = addresses - opts[:port] = ports - opts[:name] = names - opts[:search_term] = search_term data_service.services(opts) rescue Exception => e self.log_error(e, 'Problem retrieving services') diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index a55596af36..40e19a5e90 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -579,6 +579,7 @@ module Msf rhosts = [] delete_count = 0 search_term = nil + opts = {} # option parsing while (arg = args.shift) @@ -591,6 +592,7 @@ module Msf mode = :update when '-u','--up' onlyup = true + opts[:onlyup] = onlyup when '-c' list = args.shift if(!list) @@ -615,6 +617,7 @@ module Msf return end proto = proto.strip + opts[:proto] = proto when '-s' namelist = args.shift if (!namelist) @@ -622,6 +625,7 @@ module Msf return end names = namelist.strip().split(",") + opts[:name] = names when '-o' output_file = args.shift if (!output_file) @@ -638,6 +642,7 @@ module Msf set_rhosts = true when '-S', '--search' search_term = args.shift + opts[:search_term] = search_term when '-h','--help' print_line print_line "Usage: services [-h] [-u] [-a] [-r ] [-p ] [-s ] [-o ] [addr1 addr2 ...]" @@ -714,7 +719,8 @@ module Msf each_host_range_chunk(host_ranges) do |host_search| break if !host_search.nil? && host_search.empty? - framework.db.services(framework.db.workspace, onlyup, nil, host_search, nil, nil, search_term).each do |service| + opts[:addresses] = host_search + framework.db.services(framework.db.workspace, opts).each do |service| host = service.host matched_service_ids << service.id