Every month my bank sends me a PDF file with all my credit card expenses. Then normally I save these files. Today I tried to open an old file (more than 3 years), but I cannot recall the 4 numeric digits to open it.
Then I decided to use the pdfcrack tool to help me on this.
First, this file password is only 4 digits based on the credit card number:
xxxx xxxx XXXX xxxx
I can to instruct pdfcrack to only use numeric characters to test the password, passing “-c 0123456789”. Also because the password is 4 digit fixed I need to instruct pdfcrack to avoid testing password lesser than 4 chars using “-n 4”.
So that is it:
$ pdfcrack -f filepass.pdf -c 0123456789 -n 4 PDF version 1.4 Security Handler: Standard V: 2 R: 3 P: -4 Length: 128 Encrypted Metadata: True FileID: ddcb8e715b3c7347822d9548344a5964 U: ae718555d827f01765d0da553e9675e228bf4e5e4e758a4164004e56fffa0108 O: f86379060fbc201da762108dcdfe7846d1625dae9b9422e8d8fa7687eee97d05 found user-password: '7867'
I just pressed <ENTER> and it returned the password! Incredible!!!
Reference: http://www.cyberciti.biz/tips/linux-howto-crack-recover-pdf-file-password.html