Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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
share|improve this answer
    
Thanks! I forgot to mention that I want to include the ' and " characters in the charset, how would that be done? – MikeH Jul 10 '13 at 16:29
    
Edited my answer, I assumed you use BASH, because the question was tagged with grep. – Ferenc Géczi Jul 10 '13 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .