Skip to content

Commit

Permalink
chore: rename dump into showinputs
Browse files Browse the repository at this point in the history
  • Loading branch information
skyf0l committed Nov 10, 2024
1 parent 48849cd commit cf1fe85
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Options:
--public Print the public key in PEM format
--private Print the private key in PEM format
--addpassword <ADDPASSWORD> Add a password/passphrase to the private key
--dump Print all the input parameters
--dumpkey Print the private RSA key variables n, e, p, q and d
--dumpextkey Print the extended RSA key variables n, e, p, q, d, dP, dQ, pInv and qInv
--showinputs Print all the input parameters
--dump Print the private RSA key variables n, e, p, q and d
--dumpext Print the extended RSA key variables n, e, p, q, d, dP, dQ, pInv and qInv
--factors Print all factors of n
-t, --threads <THREADS> Number of threads to use. Default: number of CPUs [default: 12]
-a, --attack <ATTACK> Specify attacks to run. Default: all. (e.g. --attacks ecm,wiener,sparse)
Expand All @@ -62,7 +62,7 @@ Options:
You can also use a dump as input:

```console
$ rsacracker [OPTIONS] < challenge.txt
rsacracker [OPTIONS] < challenge.txt
[RESULTS]
$ cat challenge.txt | rsacracker [OPTIONS]
[RESULTS]
Expand All @@ -77,74 +77,74 @@ e= 1595235523[...]6275096193
### Uncipher a message from a public key

```console
$ rsacracker --key public.pem -c 0xdeadbeef
rsacracker --key public.pem -c 0xdeadbeef
```

### Uncipher a message from n and e

```console
$ rsacracker -c 0xdeadbeef -n 123...789 -e 65537
rsacracker -c 0xdeadbeef -n 123...789 -e 65537
```

### Uncipher a message from n, e and other known values

```console
$ rsacracker -c 0xdeadbeef -n 123...789 -e 65537 --phi 123 --dp 123 --dq 123 --qinv 123 --pinv 123
rsacracker -c 0xdeadbeef -n 123...789 -e 65537 --phi 123 --dp 123 --dq 123 --qinv 123 --pinv 123
```

### Uncipher a file from a public key

```console
$ rsacracker --key public.pem -f secret.txt.enc
rsacracker --key public.pem -f secret.txt.enc
```

### Run a specific attack with arguments

```console
$ rsacracker --attack known_phi -n 123...789 -e 65537 --phi 0xdeadbeef
rsacracker --attack known_phi -n 123...789 -e 65537 --phi 0xdeadbeef
```

### Generate a private key from a public key

```console
$ rsacracker --key public.pem --private
rsacracker --key public.pem --private
```

### Generate a public key from e and n

```console
$ rsacracker -e 65537 -n 0xdeadbeef --public
rsacracker -e 65537 -n 0xdeadbeef --public
```

### Dump private key secrets

```console
$ rsacracker --key private.pem --dumpkey
$ rsacracker --key private.pem --dumpextkey
rsacracker --key private.pem --dump
$ rsacracker --key private.pem --dumpext
```

### Remove password from a private key

```console
$ rsacracker --key private.pem --password R54Cr4ck3R --private
rsacracker --key private.pem --password R54Cr4ck3R --private
```

### Add password to a private key

```console
$ rsacracker --key private.pem --addpassword R54Cr4ck3R --private
rsacracker --key private.pem --addpassword R54Cr4ck3R --private
```

### Show all factors of n

```console
$ rsacracker -n 123...789 --factors
rsacracker -n 123...789 --factors
```

### Run discrete logarithm attack: when c and e are swapped in the RSA encryption formula (e^c mod n)

```console
$ rsacracker --key public.pem -c 0xdeadbeef --dlog
rsacracker --key public.pem -c 0xdeadbeef --dlog
```

## Docker
Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ struct Args {
addpassword: Option<String>,
/// Print all the input parameters.
#[clap(long)]
dump: bool,
showinputs: bool,
/// Print the private RSA key variables n, e, p, q and d.
#[clap(long)]
dumpkey: bool,
dump: bool,
/// Print the extended RSA key variables n, e, p, q, d, dP, dQ, pInv and qInv.
#[clap(long)]
dumpextkey: bool,
dumpext: bool,
/// Print all factors of n.
#[clap(long)]
factors: bool,
Expand Down Expand Up @@ -219,7 +219,7 @@ fn main() -> Result<(), MainError> {
.ok_or("Invalid key")?;
};

if args.dump {
if args.showinputs {
println!("{params}");
return Ok(());
}
Expand Down Expand Up @@ -309,12 +309,12 @@ fn main() -> Result<(), MainError> {
}

// Print private key
if args.private || args.dumpkey || args.dumpextkey {
if args.private || args.dump || args.dumpext {
if let Some(private_key) = &solution.pk {
if args.private {
print!("{}", private_key.to_pem(&args.addpassword).unwrap());
}
if args.dumpkey || args.dumpextkey {
if args.dump || args.dumpext {
println!("Private key:");
println!("n = {}", private_key.n);
println!("e = {}", private_key.e);
Expand All @@ -330,7 +330,7 @@ fn main() -> Result<(), MainError> {
}
println!("d = {}", private_key.d);
}
if args.dumpextkey {
if args.dumpext {
println!("Extended private key:");
println!("phi = {}", private_key.phi());
println!("dP = {}", private_key.dp());
Expand Down

0 comments on commit cf1fe85

Please sign in to comment.