@@ -676,13 +676,15 @@ def cmd_creds_help
676
676
print_line " -p,--port <portspec> List creds with logins on services matching this port spec"
677
677
print_line " -s <svc names> List creds matching comma-separated service names"
678
678
print_line " -u,--user <regex> List users that match this regex"
679
+ print_line " -t,--type <type> List creds that match the following types: (password,ntlm,hash)"
679
680
680
681
print_line
681
682
print_line "Examples, listing:"
682
683
print_line " creds # Default, returns all credentials"
683
684
print_line " creds 1.2.3.4/24 # nmap host specification"
684
685
print_line " creds -p 22-25,445 # nmap port specification"
685
686
print_line " creds -s ssh,smb # All creds associated with a login on SSH or SMB services"
687
+ print_line " creds -t ntlm # All NTLM creds"
686
688
print_line
687
689
688
690
print_line
@@ -822,6 +824,17 @@ def creds_search(*args)
822
824
pass_regex = Regexp . compile ( pass )
823
825
end
824
826
827
+ if ptype
828
+ type = case ptype
829
+ when 'password'
830
+ Metasploit ::Credential ::Password
831
+ when 'hash'
832
+ Metasploit ::Credential ::PasswordHash
833
+ when 'ntlm'
834
+ Metasploit ::Credential ::NTLMHash
835
+ end
836
+ end
837
+
825
838
# normalize
826
839
ports = port_ranges . flatten . uniq
827
840
svcs . flatten!
@@ -839,6 +852,9 @@ def creds_search(*args)
839
852
840
853
query . each do |core |
841
854
855
+ # Exclude creds that don't match the given type
856
+ next if type . present? && !core . private . kind_of? ( type )
857
+
842
858
# Exclude creds that don't match the given user
843
859
if user_regex . present? && !core . public . username . match ( user_regex )
844
860
next
0 commit comments