Make user and pass options on cred lookup literal

Fixes #11555
master
James Barnett 2019-04-17 12:37:59 -05:00
parent 03cb3e31db
commit 681a4c43c6
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
2 changed files with 4 additions and 4 deletions

View File

@ -29,12 +29,12 @@ module Msf::DBManager::Cred
if opts[:user].present? if opts[:user].present?
# If we have a user regex, only include those that match # If we have a user regex, only include those that match
query = query.where('"metasploit_credential_publics"."username" ~* ?', opts[:user]) query = query.where('"metasploit_credential_publics"."username" = ?', opts[:user])
end end
if opts[:pass].present? if opts[:pass].present?
# If we have a password regex, only include those that match # If we have a password regex, only include those that match
query = query.where('"metasploit_credential_privates"."data" ~* ?', opts[:pass]) query = query.where('"metasploit_credential_privates"."data" = ?', opts[:pass])
end end
if opts[:host_ranges] || opts[:ports] || opts[:svcs] if opts[:host_ranges] || opts[:ports] || opts[:svcs]

View File

@ -172,10 +172,10 @@ class Creds
print_line " -d,--delete Delete one or more credentials" print_line " -d,--delete Delete one or more credentials"
print_line print_line
print_line "Filter options for listing" print_line "Filter options for listing"
print_line " -P,--password <regex> List passwords that match this regex" print_line " -P,--password <text> List passwords that match this text"
print_line " -p,--port <portspec> List creds with logins on services matching this port spec" print_line " -p,--port <portspec> List creds with logins on services matching this port spec"
print_line " -s <svc names> List creds matching comma-separated service names" print_line " -s <svc names> List creds matching comma-separated service names"
print_line " -u,--user <regex> List users that match this regex" print_line " -u,--user <text> List users that match this text"
print_line " -t,--type <type> List creds that match the following types: #{allowed_cred_types.join(',')}" print_line " -t,--type <type> List creds that match the following types: #{allowed_cred_types.join(',')}"
print_line " -O,--origins <IP> List creds that match these origins" print_line " -O,--origins <IP> List creds that match these origins"
print_line " -R,--rhosts Set RHOSTS from the results of the search" print_line " -R,--rhosts Set RHOSTS from the results of the search"