03-15-2017, 09:29 AM
(This post was last modified: 03-17-2017, 07:02 AM by devilsadvocate.)
Are there any utilities to convert passwords in a pot file to all hex or all plaintext?
For example, if I have a potfile and it has mixed entries for found passwords and some look like $HEX[hexcharactershere], is there a way to convert those to their plain-text equivalent?
Related to that, would converting from hex to ascii be problematic if some CR/LF/NUL characters are present?
See here: https://hashcat.net/forum/thread-2483.html
Similarly, is there a way to convert all plaintext entries from a potfile to all $HEX[] format?
For hex to ascii conversion, this will do in a pinch (not tested):
From https://hashcat.net/forum/thread-3522.html
perl -ne 'if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {print pack("H*", $1), "\n"}'
But what about ascii to hex?
I will probably write something if this doesn't exist.
*Edited*
Cheers to royce and undeath for making all of the following scripts possible:
Scripts that you will find in this post:
convert_plaintext_2_hex.pl - converts plaintext password files to their equivalent values in hex
convert_hex_2_plaintext.pl - converts passwords in $HEX format to their equivalent in plaintext.
convert_potfile_plain_2_hex.pl - leaves all hashes intact in a potfile and converts all found passwords to $HEX format
convert_potfile_hex_2_plain.pl - leaves all hashes intact in a potfile and converts all found passwords to plaintext format
convert_plaintext_2_hex.pl
Use convert_plaintext_2_hex.pl like this:
cat passwords.txt | convert_plain_2_hex.pl > passwords_hex_format.txt
or an example with an unsalted md5 potfile (adjust bytes with cut as necessary depending on hash type)
cat md5_found.pot | cut -b 1-33 --complement | convert_plaintext_2_hex.pl > md5_pot_passwords_in_hex.txt
convert_hex_2_plaintext.pl
Use convert_hex_2_plaintext.pl like this:
cat passwords.txt | convert_hex_2_plain.pl > passwords_plaintext_format.txt
or an example with an unsalted md5 potfile (adjust bytes with cut as necessary depending on hash type)
cat md5_found.pot | cut -b 1-33 --complement | convert_hex_2_plaintext.pl > md5_pot_passwords_in_plaintext.txt
convert_potfile_plain_2_hex.pl
Use convert_potfile_plain_2_hex.pl like this:
cat found_passwords.pot | convert_potfile_plain_2_hex.pl > potfile_hashes_and_plaintext_passwords.txt
convert_potfile_hex_2_plain.pl
Use convert_potfile_hex_2_plain.pl like this:
cat found_passwords.pot | convert_potfile_hex_2_plain.pl > potfile_hashes_and_HEX_passwords.txt
In addition to the above, there are utilities available from insidepro. Those are available at: http://www.insidepro.com/download/HM.zip
For example, if I have a potfile and it has mixed entries for found passwords and some look like $HEX[hexcharactershere], is there a way to convert those to their plain-text equivalent?
Related to that, would converting from hex to ascii be problematic if some CR/LF/NUL characters are present?
See here: https://hashcat.net/forum/thread-2483.html
Similarly, is there a way to convert all plaintext entries from a potfile to all $HEX[] format?
For hex to ascii conversion, this will do in a pinch (not tested):
From https://hashcat.net/forum/thread-3522.html
perl -ne 'if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {print pack("H*", $1), "\n"}'
But what about ascii to hex?
I will probably write something if this doesn't exist.
*Edited*
Cheers to royce and undeath for making all of the following scripts possible:
Scripts that you will find in this post:
convert_plaintext_2_hex.pl - converts plaintext password files to their equivalent values in hex
convert_hex_2_plaintext.pl - converts passwords in $HEX format to their equivalent in plaintext.
convert_potfile_plain_2_hex.pl - leaves all hashes intact in a potfile and converts all found passwords to $HEX format
convert_potfile_hex_2_plain.pl - leaves all hashes intact in a potfile and converts all found passwords to plaintext format
convert_plaintext_2_hex.pl
Code:
#!/usr/bin/env perl
use utf8;
while (<>) {
if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {
print $_;
} else {
if ($_ =~ m/(.*)/) {
print unpack("H*", $1) . "\n"
}
}
}
Use convert_plaintext_2_hex.pl like this:
cat passwords.txt | convert_plain_2_hex.pl > passwords_hex_format.txt
or an example with an unsalted md5 potfile (adjust bytes with cut as necessary depending on hash type)
cat md5_found.pot | cut -b 1-33 --complement | convert_plaintext_2_hex.pl > md5_pot_passwords_in_hex.txt
convert_hex_2_plaintext.pl
Code:
#!/usr/bin/env perl
while (<>) {
if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {
print pack("H*", $1), "\n"
} else {
print $_;
}
}
Use convert_hex_2_plaintext.pl like this:
cat passwords.txt | convert_hex_2_plain.pl > passwords_plaintext_format.txt
or an example with an unsalted md5 potfile (adjust bytes with cut as necessary depending on hash type)
cat md5_found.pot | cut -b 1-33 --complement | convert_hex_2_plaintext.pl > md5_pot_passwords_in_plaintext.txt
convert_potfile_plain_2_hex.pl
Code:
#!/usr/bin/env perl
use utf8;
while (<>) {
if ($_ =~ m/(.*):\$HEX\[([A-Fa-f0-9]+)\]/) {
print $_;
} else {
if ($_ =~ m/(.*?):(.*)/) {
print $1 . ':$HEX[' . unpack("H*", $2) . ']' . "\n"
}
}
}
Use convert_potfile_plain_2_hex.pl like this:
cat found_passwords.pot | convert_potfile_plain_2_hex.pl > potfile_hashes_and_plaintext_passwords.txt
convert_potfile_hex_2_plain.pl
Code:
#!/usr/bin/env perl
use utf8;
while (<>) {
if ($_ =~ m/(.*):\$HEX\[([A-Fa-f0-9]+)\]/) {
print $1 . ':' . pack("H*", $2), "\n"
} else {
print $_;
}
}
Use convert_potfile_hex_2_plain.pl like this:
cat found_passwords.pot | convert_potfile_hex_2_plain.pl > potfile_hashes_and_HEX_passwords.txt
In addition to the above, there are utilities available from insidepro. Those are available at: http://www.insidepro.com/download/HM.zip