4

I'm trying to recover a password from a PDF file using pdfcrack. I want to change the charset to include special characters.

Can I use some kind of i/o redirect to feed the contents of a a similiar file like this:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(''/\||""

into the charset parameter? Instead of trying to escape all the special characters properly into one huge command?

MikeH
  • 41

1 Answers1

5

BASH ( Linux, Mac OS X, Windows with Cygwin )

You don't have to escape anything, put the charset between '' like this:

pdfcrack -c 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(''/\||""' Some.pdf

But if you really want to read the charset from a file then you can do it like this:

MY_CHARS=$(cat charset.txt); pdfcrack -c $MY_CHARS Some.pdf

CMD ( Windows only)

Put the charset between "" and only escape " itself with double "" like this:

C:\>pdfcrack.exe -c "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%?^&*(''/\||'""" Some.pdf

Charset from file (same escaping rule need to be applied on the file content):

C:\>set /p CHARSET=<charset.txt & pdfcrack.exe -c %CHARSET% Some.pdf