Created
March 4, 2026 15:16
-
-
Save ronoaldo/42db9ef21ecca2896febd3459739bbb6 to your computer and use it in GitHub Desktop.
Brute forcing PDF dumb passwords in a few seconds...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # sudo apt install qpdf first if needed | |
| # adjust range accordingly in lines 9 and 10 | |
| INPUT="$1" | |
| printf "Bruteforcing password with numeric 4 digit key:\n" | |
| time for i in $(seq 1 9999); do | |
| pass="$(printf '%04d' $i)" | |
| printf "Trying '%s': " "$pass" | |
| qpdf --decrypt --password="$pass" "$INPUT" "$INPUT.decrypted.pdf" && { | |
| printf "Success!\n" | |
| exit 0 | |
| } | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment