Fix query array encoding issue

GSoC/Meterpreter_Web_Console
Matthew Kienow 2018-02-02 17:16:12 -05:00
parent 67b7af3385
commit dcf4171cfb
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
2 changed files with 4 additions and 3 deletions

View File

@ -108,7 +108,8 @@ class RemoteHTTPDataService
#
def make_request(request_type, path, data_hash = nil, query = nil)
begin
query_str = (!query.nil? && !query.empty?) ? URI.encode_www_form(append_workspace(query)) : nil
# simplify query by removing nil values
query_str = (!query.nil? && !query.empty?) ? append_workspace(query).compact.to_query : nil
uri = URI::HTTP::build({path: path, query: query_str})
puts "#{Time.now} - HTTP #{request_type} request to #{uri.request_uri} with #{data_hash ? data_hash : "nil"}"

View File

@ -152,9 +152,9 @@ module Msf::DBManager::Host
conditions = {}
conditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if opts[:non_dead]
conditions[:address] = opts[:addresses] if opts[:addresses]
conditions[:address] = opts[:addresses] if opts[:addresses] && !opts[:addresses].empty?
if opts[:search_term]
if opts[:search_term] && !opts[:search_term].empty?
column_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Mdm::Host, opts[:search_term])
tag_conditions = Arel::Nodes::Regexp.new(Mdm::Tag.arel_table[:name], Arel::Nodes.build_quoted("(?mi)#{opts[:search_term]}"))
search_conditions = column_search_conditions.or(tag_conditions)