Potfile format - to hex or not to hex
#3
(03-15-2017, 03:02 PM)royce Wrote: FWIW, I've been using that same Perl one-liner from undeath, expanded for readability and converted to a standalone script:

Code:
#!/usr/bin/env perl

# Credit: undeath, https://hashcat.net/forum/thread-3522.html

while (<>) {
   if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {
       print pack("H*", $1), "\n"
   } else {
       print $_;
   }
}

The inverse could be used to perform the conversion in the other direction.

Out of curiosity - what is the use case for converting to all HEX?

Storing the list of values in a column in a database table would be one.  Commas and single quote characters that could be in passwords don't play nice with an insert statement.

Either that or a hashcat user would like to use "--hex-wordlist" instead of traditional plain text.

And then, of course, there is trying all plaintext passwords in their hex form up against your hash(es).

For anyone who cares, this will convert all plaintext passwords into hex format.

Code:
#!/usr/bin/env perl

# Credit: devilsadvocate (inspired by royce)

while (<>) {
  if ($_ =~ m/\$HEX\[([A-Fa-f0-9]+)\]/) {
      print $_;
  } else {
      print unpack("H*", $_), "\n"
  }
}


Messages In This Thread
RE: Potfile format - to hex or not to hex - by devilsadvocate - 03-16-2017, 12:37 AM