Skip to content

Commit 60e728e

Browse files
author
Brent Cook
committed
Land rapid7#7065, Correct display errors for SHA-512 hashes with MS SQL Server 2012
2 parents 50fc3b1 + 8b050fc commit 60e728e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/post/windows/gather/credentials/mssql_local_hashdump.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,16 @@ def get_sql_hash(instance_name)
112112

113113
print_status("Attempting to get password hashes...")
114114

115-
get_hash_result = run_sql(query, instance_name)
115+
res = run_sql(query, instance_name)
116116

117-
if get_hash_result.include?('0x')
117+
if res.include?('0x')
118118
# Parse Data
119-
hash_array = get_hash_result.split("\r\n").grep(/0x/)
119+
if hash_type == "mssql12"
120+
res = res.unpack('H*')[0].gsub("200d0a", "_CRLF_").gsub("0d0a", "").gsub("_CRLF_", "0d0a").gsub(/../) {
121+
|pair| pair.hex.chr
122+
}
123+
end
124+
hash_array = res.split("\r\n").grep(/0x/)
120125

121126
store_hashes(hash_array, hash_type)
122127
else

0 commit comments

Comments
 (0)