mirror of
https://github.com/nelsbrock/fingerprunk.git
synced 2026-08-14 16:12:08 +02:00
74 lines
2.9 KiB
Markdown
74 lines
2.9 KiB
Markdown
# Fingerprunk
|
||
|
||
**Fingerprunk** (/ˈfɪŋɐpʁʊŋk/; from *fingerprint* and German *Prunk* 'pageantry, splendor') is
|
||
a CLI tool for brute-forcing OpenPGP keys with fingerprints that match a given regex.
|
||
|
||
## Installation
|
||
|
||
Install [Rust](https://rust-lang.org/tools/install/), then install Fingerprunk from crates.io:
|
||
|
||
```sh
|
||
cargo install fingerprunk
|
||
```
|
||
|
||
## Usage
|
||
|
||
Let's say you want to find keys whose fingerprints begin with `C0FFEE` and store them
|
||
at `secret.asc`. The regex for this is `^C0FFEE`. Now, simply use the following command to start
|
||
the search:
|
||
|
||
```sh
|
||
fingerprunk -r '^C0FFEE' >> secret.asc
|
||
```
|
||
|
||
Fingerprunk will now generate many keys and write out all keys with matching fingerprints to
|
||
standard output (here: `secret.asc`).
|
||
|
||
If you want Fingerprunk to output password-encrypted keys use the `-p` flag and you will be prompted
|
||
for a password.
|
||
|
||
### Regex format
|
||
|
||
Fingerprunk uses [fancy-regex](https://crates.io/crates/fancy-regex), for which you can test and
|
||
debug your regexes at the [fancy-regex playground](https://fancy-regex.github.io/fancy-regex/).
|
||
|
||
The regex is matched against the upper-case hexadecimal representation of the fingerprint, e.g.
|
||
`C0FFEE2494E2B365CAB564236C79CDD8F048CBDC`.
|
||
|
||
Here is some inspiration for regexes you could use:
|
||
|
||
| Regex | Description |
|
||
| :------------ | :--------------------------------------- |
|
||
| `^C0FFEE` | String `C0FFEE` at the beginning |
|
||
| `0FF1CE$` | String `0FF1CE` at the end |
|
||
| `(.)\1{7}` | A string of eight identical characters |
|
||
| `^(....)*FFFF` | String `FFFF` aligned to a 4-digit group |
|
||
|
||
Be sure to escape your regex in your shell, e.g. `'(.)\\1{7}'` instead of `'(.)\1{7}'`.
|
||
|
||
Also see <https://en.wikipedia.org/wiki/Hexspeak> for some further examples of "hexadecimal words".
|
||
|
||
### How long does it take?
|
||
|
||
On my machine with an AMD Ryzen 7 5800X processor, Fingerprunk is able to generate and check about
|
||
41000 keys per second. This means that for finding a fingerprint with a string of *n* specific
|
||
hexadecimal digits at a specific place, I could expect the following runtimes until finding the
|
||
first key:
|
||
|
||
| *n* | estimate tries | estimate time |
|
||
| --: | ---------------------: | ------------: |
|
||
| 1 | 16 = 16¹ | < 0.1 secs |
|
||
| 2 | 256 = 16² | < 0.1 secs |
|
||
| 3 | 4096 = 16³ | 0.1 secs |
|
||
| 4 | 65536 = 16⁴ | 1.6 secs |
|
||
| 5 | 1048576 = 16⁵ | 26 secs |
|
||
| 6 | 16777216 = 16⁶ | 7 mins |
|
||
| 7 | 268435456 = 16⁷ | 2 hours |
|
||
| 8 | 4294967296 = 16⁸ | 1 days |
|
||
| 9 | 68719476736 = 16⁹ | 19 days |
|
||
| 10 | 1099511627776 = 16¹⁰ | 310 days |
|
||
| 11 | 17592186044416 = 16¹¹ | 14 years |
|
||
| 12 | 281474976710656 = 16¹² | 218 years |
|
||
|
||
As you can see, anything above 10 fixed digits is pretty much unfeasible, at least with a normal
|
||
personal computer. |