1

I received a pdf file few days back, the pdf file was password protected with a 5 digit number varying from 20000 to 25999. Unfortunately I forgot the password but still I remember that it falls within the mentioned set of numbers. Manually its really difficult for me to try each and every alternative one after another.

Kindly let me know if I want a brute force mechanism (or some other better option) then how to achieve this.

15
  • Don't know how to do it in java, but should be easy with AutoIt.
    – mwerschy
    Jun 8, 2013 at 12:51
  • Okular with ignore author rights option?
    – yttrium
    Jun 8, 2013 at 12:52
  • Do you really need a Java solution? Jun 8, 2013 at 12:52
  • No need of java. Just need to recover it anyhow and thats it. I thought if nothing is available then will try in Java as the last option.
    – user182944
    Jun 8, 2013 at 12:52
  • 2
    @Hennes: Which PDF apps are you talking about? It's been years since I've used Adobe's useless offering, and as far as I remember neither Foxit nor Sumatra nor the others ignored the user password. Older versions might have ignored the owner password (that restricts printing, copying etc.), but not the user password that prevented opening the file.
    – Karan
    Jun 8, 2013 at 15:59

1 Answer 1

4

On Linux/Unix/Cygwin you could automate the decryption by using qpdf and a loop that goes through all possible combinations:

#!/bin/bash

echo "Decrypting PDF file"

for i in $(eval echo "{20000..25999}"); do

echo "try nr. $i"
qpdf --password=$i --decrypt input.pdf output.pdf

RET=$?
if [[ $RET == 0 ]]; then
  echo "File succesfully decrypted."
  exit
fi

done

Others might be able to help you with getting this to work on Windows.

You must log in to answer this question.

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