Honor realm in creds -S

GSoC/Meterpreter_Web_Console
James Barnett 2018-07-20 16:30:17 -05:00
parent 08e1941e9b
commit b250c4e3f4
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
2 changed files with 4 additions and 3 deletions

View File

@ -11,7 +11,7 @@ module Msf::DBManager::Cred
end
query = Metasploit::Credential::Core.where( workspace_id: wspace.id )
query = query.includes(:private, :public, :logins).references(:private, :public, :logins)
query = query.includes(:private, :public, :logins, :realm).references(:private, :public, :logins, :realm)
query = query.includes(logins: [ :service, { service: :host } ])
if opts[:type].present?
@ -46,8 +46,8 @@ module Msf::DBManager::Cred
core_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Metasploit::Credential::Core, search_term, ['created_at', 'updated_at'])
public_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Metasploit::Credential::Public, search_term, ['created_at', 'updated_at'])
private_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Metasploit::Credential::Private, search_term, ['created_at', 'updated_at'])
column_search_conditions = core_search_conditions.or(public_search_conditions).or(private_search_conditions)
Metasploit::Credential::Core.where(column_search_conditions).includes(:private, :public).references(:private, :public).count
realm_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Metasploit::Credential::Realm, search_term, ['created_at', 'updated_at'])
column_search_conditions = core_search_conditions.or(public_search_conditions).or(private_search_conditions).or(realm_search_conditions)
query = query.where(column_search_conditions)
end
}

View File

@ -172,6 +172,7 @@ class Creds
print_line " -t,--type <type> List creds that match the following types: #{allowed_cred_types.join(',')}"
print_line " -O,--origins List creds that match these origins"
print_line " -R,--rhosts Set RHOSTS from the results of the search"
print_line " -S,--search-term Search across all fields using regex"
print_line
print_line "Examples, listing:"