@@ -57,19 +57,19 @@ def run
57
57
# on 10.8+ ShadowHashData stores a binary plist inside of the user.plist
58
58
# Here we pull out the binary plist bytes and use built-in plutil to convert to xml
59
59
plist_bytes = shadow_bytes . split ( '' ) . each_slice ( 2 ) . map { |s | "\\ x#{ s [ 0 ] } #{ s [ 1 ] } " } . join
60
-
60
+
61
61
# encode the bytes as \x hex string, print using bash's echo, and pass to plutil
62
62
shadow_plist = cmd_exec ( "/bin/bash -c 'echo -ne \" #{ plist_bytes } \" | plutil -convert xml1 - -o -'" )
63
-
63
+
64
64
# read the plaintext xml
65
65
shadow_xml = REXML ::Document . new ( shadow_plist )
66
-
66
+
67
67
# parse out the different parts of sha512pbkdf2
68
68
dict = shadow_xml . elements [ 1 ] . elements [ 1 ] . elements [ 2 ]
69
69
entropy = Rex ::Text . to_hex ( dict . elements [ 2 ] . text . gsub ( /\s +/ , '' ) . unpack ( 'm*' ) [ 0 ] , '' )
70
70
iterations = dict . elements [ 4 ] . text . gsub ( /\s +/ , '' )
71
71
salt = Rex ::Text . to_hex ( dict . elements [ 6 ] . text . gsub ( /\s +/ , '' ) . unpack ( 'm*' ) [ 0 ] , '' )
72
-
72
+
73
73
# PBKDF2 stored in <user, iterations, salt, entropy> format
74
74
decoded_hash = "#{ user } :$ml$#{ iterations } $#{ salt } $#{ entropy } "
75
75
print_good "SHA512:#{ decoded_hash } "
@@ -164,7 +164,7 @@ def lion?
164
164
def lte_tiger?
165
165
ver_num =~ /10\. (\d +)/ and $1. to_i <= 4
166
166
end
167
-
167
+
168
168
# parse the dslocal plist in lion
169
169
def read_ds_xml_plist ( plist_content )
170
170
doc = REXML ::Document . new ( plist_content )
0 commit comments