From cf1fe8506fe51e7c0dd241e8288dce5442a983ba Mon Sep 17 00:00:00 2001 From: Skyf0l <59019720+skyf0l@users.noreply.github.com> Date: Sun, 10 Nov 2024 14:30:47 +0100 Subject: [PATCH] chore: rename dump into showinputs --- README.md | 34 +++++++++++++++++----------------- src/main.rs | 14 +++++++------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f86107a..a02e70b 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ Options: --public Print the public key in PEM format --private Print the private key in PEM format --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 Number of threads to use. Default: number of CPUs [default: 12] -a, --attack Specify attacks to run. Default: all. (e.g. --attacks ecm,wiener,sparse) @@ -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] @@ -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 diff --git a/src/main.rs b/src/main.rs index 07ca3e6..5b05c4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,13 +96,13 @@ struct Args { addpassword: Option, /// 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, @@ -219,7 +219,7 @@ fn main() -> Result<(), MainError> { .ok_or("Invalid key")?; }; - if args.dump { + if args.showinputs { println!("{params}"); return Ok(()); } @@ -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); @@ -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());