{"id":16967890,"url":"https://github.com/skyf0l/rsacracker","last_synced_at":"2025-04-04T02:08:26.173Z","repository":{"id":134742865,"uuid":"281464593","full_name":"skyf0l/RsaCracker","owner":"skyf0l","description":"Powerful RSA cracker for CTFs. Supports RSA, X509, OPENSSH in PEM and DER formats.","archived":false,"fork":false,"pushed_at":"2024-10-02T07:50:44.000Z","size":476,"stargazers_count":93,"open_issues_count":8,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-15T00:10:03.217Z","etag":null,"topics":["crypto","cryptography","ctf","ctf-tools","rsa"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skyf0l.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-21T17:41:42.000Z","updated_at":"2024-10-14T14:22:14.000Z","dependencies_parsed_at":"2024-01-11T12:41:32.765Z","dependency_job_id":"4bdd2d6a-b65f-4d96-916d-bca59e646dfb","html_url":"https://github.com/skyf0l/RsaCracker","commit_stats":null,"previous_names":["skyf0l/rsacracker"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FRsaCracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FRsaCracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FRsaCracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FRsaCracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyf0l","download_url":"https://codeload.github.com/skyf0l/RsaCracker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107828,"owners_count":20884797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","cryptography","ctf","ctf-tools","rsa"],"created_at":"2024-10-14T00:10:03.870Z","updated_at":"2025-04-04T02:08:26.145Z","avatar_url":"https://github.com/skyf0l.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSA Cracker\n\n[![Build](https://github.com/skyf0l/RsaCracker/actions/workflows/ci.yml/badge.svg)](https://github.com/skyf0l/RsaCracker/actions/workflows/ci.yml)\n[![Crate.io](https://img.shields.io/crates/v/rsacracker.svg)](https://crates.io/crates/rsacracker)\n[![Docker Image Version](https://img.shields.io/docker/v/skyf0l/rsacracker?logo=docker)](https://hub.docker.com/r/skyf0l/rsacracker)\n[![codecov](https://codecov.io/gh/skyf0l/rsacracker/branch/main/graph/badge.svg)](https://codecov.io/gh/skyf0l/rsacracker)\n\nPowerful RSA cracker for CTFs. Supports RSA, X509, OPENSSH in PEM and DER formats.\n\nRsaCracker provides a simple interface to crack RSA keys and ciphers. With a collection of thousands of attacks, no key \u003c!-- or at least that's what I hope --\u003e can survive against RsaCracker!\n\n## Installation\n\nFrom crates.io:\n\n```console\ncargo install rsacracker\n```\n\nNote: To build on windows, you need to use [MSYS2](https://www.msys2.org/). This is required because of the [rug](https://crates.io/crates/rug) dependency. See [building-on-windows](https://gitlab.com/tspiteri/gmp-mpfr-sys#building-on-windows) for more information.\n\n## Usage\n\n```text\nPowerful RSA cracker for CTFs. Supports RSA, X509, OPENSSH in PEM and DER formats.\n\nUsage: rsacracker [OPTIONS]\n\nOptions:\n  -r, --raw \u003cRAW\u003e                  Retrieve values from raw file\n  -c, --cipher \u003cCIPHER\u003e            Cipher: the message to uncipher\n  -f, --cipherfile \u003cCIPHERFILE\u003e    Cipher file: the file to uncipher\n  -o, --outfile \u003cOUTFILE\u003e          Write unciphered data to a file. If many unciphered data are found, they will be written to files suffixed with _1, _2, ...\n  -n \u003cN\u003e                           Modulus\n  -e \u003cE\u003e                           Public exponent. Default: 65537 [default: 65537]\n  -p \u003cP\u003e                           Prime number p\n  -q \u003cQ\u003e                           Prime number q\n  -d \u003cD\u003e                           Private exponent\n      --phi \u003cPHI\u003e                  Phi or Euler's totient function of n. (p-1)(q-1)\n      --dp \u003cDP\u003e                    dP or dmp1 CRT exponent. (d mod p-1)\n      --dq \u003cDQ\u003e                    dQ or dmq1 CRT exponent. (d mod q-1)\n      --qinv \u003cQINV\u003e                qInv or iqmp CRT coefficient. (q^-1 mod p)\n      --pinv \u003cPINV\u003e                pInv or ipmq CRT coefficient. (p^-1 mod q)\n      --sum-pq \u003cSUM_PQ\u003e            The sum of the two primes p and q\n      --dlog                       Discrete logarithm attack. When c and e are swapped in the RSA encryption formula. (e^c mod n)\n  -k, --key \u003cKEY\u003e                  Public or private key file. (RSA, X509, OPENSSH in PEM and DER formats.)\n      --password \u003cPASSWORD\u003e        Private key password/passphrase if encrypted\n      --public                     Print the public key in PEM format\n      --private                    Print the private key in PEM format\n      --addpassword \u003cADDPASSWORD\u003e  Add a password/passphrase to the private key\n      --showinputs                 Print all the input parameters\n      --dump                       Print the private RSA key variables n, e, p, q and d\n      --dumpext                    Print the extended RSA key variables n, e, p, q, d, dP, dQ, pInv and qInv\n      --factors                    Print all factors of n\n  -t, --threads \u003cTHREADS\u003e          Number of threads to use. Default: number of CPUs [default: 12]\n  -a, --attack \u003cATTACK\u003e            Specify attacks to run. Default: all. (e.g. --attacks ecm,wiener,sparse)\n      --exclude \u003cEXCLUDE\u003e          Specify attacks to exclude. Default: none. (e.g. --exclude ecm,wiener,sparse)\n      --list                       List all available attacks\n  -h, --help                       Print help\n  -V, --version                    Print version\n```\n\nYou can also use a dump as input:\n\n```console\n$ rsacracker [OPTIONS] \u003c challenge.txt\n[RESULTS]\n$ cat challenge.txt | rsacracker [OPTIONS]\n[RESULTS]\n$ cat challenge.txt\nc: 7839407718[...]0577093673\nn = 9359619564[...]3745124619\ne= 1595235523[...]6275096193\n```\n\n## Examples\n\n### Uncipher a message from a public key and write it to a file\n\n```console\nrsacracker --key public.pem -c 0xdeadbeef -o result.txt\n```\n\n### Uncipher a message from n and e\n\n```console\nrsacracker -c 0xdeadbeef -n 123...789 -e 65537\n```\n\n### Uncipher a message from n, e and other known values\n\n```console\nrsacracker -c 0xdeadbeef -n 123...789 -e 65537 --phi 123 --dp 123 --dq 123 --qinv 123 --pinv 123\n```\n\n### Uncipher a file from a public key\n\n```console\nrsacracker --key public.pem -f secret.txt.enc\n```\n\n### Run a specific attack with arguments\n\n```console\nrsacracker --attack known_phi -n 123...789 -e 65537 --phi 0xdeadbeef\n```\n\n### Generate a private key from a public key\n\n```console\nrsacracker --key public.pem --private\n```\n\n### Generate a public key from e and n\n\n```console\nrsacracker -e 65537 -n 0xdeadbeef --public\n```\n\n### Dump private key secrets\n\n```console\nrsacracker --key private.pem --dump\n$ rsacracker --key private.pem --dumpext\n```\n\n### Remove password from a private key\n\n```console\nrsacracker --key private.pem --password R54Cr4ck3R --private\n```\n\n### Add password to a private key\n\n```console\nrsacracker --key private.pem --addpassword R54Cr4ck3R --private\n```\n\n### Show all factors of n\n\n```console\nrsacracker -n 123...789 --factors\n```\n\n### Run discrete logarithm attack: when c and e are swapped in the RSA encryption formula (e^c mod n)\n\n```console\nrsacracker --key public.pem -c 0xdeadbeef --dlog\n```\n\n## Docker\n\nFrom dockerhub:\n\n```console\ndocker pull skyf0l/rsacracker\ndocker run -it --rm -v $PWD:/data skyf0l/rsacracker [args]\n```\n\nOr build it yourself:\n\n```console\nDOCKER_BUILDKIT=1 docker build . --file Dockerfile -t rsacracker\ndocker run -it --rm -v $PWD:/data rsacracker [args]\n```\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0\n  ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license\n  ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Frsacracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyf0l%2Frsacracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Frsacracker/lists"}