nasty
Nasty is a tool that helps recover forgotten GPG or PGP key passphrases. It supports customizable length, guessing modes, and charset filters.
Description
Nasty is a program designed to recover the passphrase of PGP or GPG keys when forgotten or lost. It is particularly useful in forensics investigations where access to encrypted data is needed without the original passphrase.
Key features include setting minimum and maximum passphrase lengths, selecting guessing modes such as incremental, random, or file-based, and filtering by character sets. This allows for targeted brute-force attempts tailored to likely passphrase characteristics.
The tool integrates with GPG libraries and requires specific dependencies like libc6 and libgpgme45. It outputs the recovered passphrase to a specified file and supports verbose mode for monitoring progress.
How It Works
Nasty uses GPGME library to interact with GPG keys and test passphrases against a selected key via the -k filter. It generates passphrase candidates based on mode: incremental tries all combinations within length and charset limits; random generates guesses probabilistically; file mode reads candidates from an input file. Charsets are filtered from options like a-z, A-Z, digits, or full ASCII/extended ranges, defaulting to 32-255. Successful matches are written to the output file.
Installation
sudo apt install nastyFlags
Examples
nasty -hnasty -a 4 -b 8 -m incremental -c aA0 -k keyidnasty -m random -c + -k keyid -vnasty -m file -i passlist.txt -f found.txt -k keyidnasty -a 6 -b 12 -m incremental -c aA0. -k keyidnasty -m random -c aA -f recovered_pass.txt -k '*'nasty -a 1 -b 20 -m incremental -c + -v