Created
September 1, 2017 22:13
-
-
Save exorcyst/df397c07ae6c338ac0ff58f9b9cea6e6 to your computer and use it in GitHub Desktop.
quick perl script to print accounts across multiple hashdumps with the same password hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# iterate over each file | |
foreach $y (@ARGV) | |
{ | |
open FH, $y; | |
while ($x = <FH>) | |
{ | |
# get rid of trailing newlines | |
chomp $x; | |
# split on : (assuming pwdump format) | |
@arr = split /:/,$x; | |
# check to see if the NT hash exists in our assoc array of hashes | |
if (!(exists $HASH{$arr[3]})) | |
{ | |
# if no, insert | |
$HASH{$arr[3]} = $arr[0]; | |
} | |
else | |
{ | |
# if yes, then append to existing with a comma and a space | |
$HASH{$arr[3]} = $HASH{$arr[3]} . ' , ' . $arr[0]; | |
} | |
} | |
close FH; | |
} | |
# iterate over each of the keys of the HASH assoc array | |
foreach $z (sort keys %HASH) | |
{ | |
# print out the hash and the accounts referenced | |
print "$z = ",$HASH{$z} . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment