Ganapati / RsaCtfTool
- понедельник, 24 мая 2021 г. в 00:28:39
RSA attack tool (mainly for ctf) - retreive private key from weak public key and/or uncipher data
RSA multi attacks tool : uncipher data from weak public key and try to recover private key Automatic selection of best attack for the given public key
Attacks :
usage: RsaCtfTool.py [-h] [--publickey PUBLICKEY] [--timeout TIMEOUT]
[--createpub] [--dumpkey] [--ext] [--sendtofdb]
[--uncipherfile UNCIPHERFILE] [--uncipher UNCIPHER]
[--verbosity {CRITICAL,ERROR,WARNING,DEBUG,INFO}]
[--private] [--ecmdigits ECMDIGITS] [-n N] [-p P] [-q Q]
[-e E] [--key KEY] [--isconspicuous] [--convert_idrsa_pub] [--isroca] [--check_publickey]
[--attack {fermat_numbers_gcd,comfact_cn,wiener,factordb,smallq,pollard_rho,euler,z3_solver,neca,cm_factor,mersenne_pm1_gcd,SQUFOF,small_crt_exp,fibonacci_gcd,smallfraction,boneh_durfee,roca,fermat,londahl,mersenne_primes,partial_q,siqs,noveltyprimes,binary_polinomial_factoring,primorial_pm1_gcd,pollard_p_1,ecm2,cube_root,system_primes_gcd,dixon,ecm,pastctfprimes,qicheng,wolframalpha,hastads,same_n_huge_e,commonfactors,all}]
Mode 1 : Attack RSA (specify --publickey or n and e)
Mode 2 : Create a Public Key File Given n and e (specify --createpub)
Mode 3 : Dump the public and/or private numbers (optionally including CRT parameters in extended mode) from a PEM/DER format public or private key (specify --dumpkey)
./RsaCtfTool.py --publickey ./key.pub --uncipherfile ./ciphered\_file
./RsaCtfTool.py --publickey ./key.pub --private
./RsaCtfTool.py --publickey "*.pub" --private
./RsaCtfTool.py --publickey "*.pub" --private
--sendtofdb
./RsaCtfTool.py --createpub -n 7828374823761928712873129873981723...12837182 -e 65537
./RsaCtfTool.py --dumpkey --key ./key.pub
./RsaCtfTool.py --key examples/conspicuous.priv --isconspicuous
./RsaCtfTool.py --publickey key.pub --ecmdigits 25 --verbose --private
For more examples, look at test.sh file
./RsaCtfTool.py --convert_idrsa_pub --publickey $HOME/.ssh/id_rsa.pub
./RsaCtfTool.py --isroca --publickey "examples/*.pub"
docker pull Ganapati/RsaCtfTool
docker run -it --rm -v $PWD:/data Ganapati/RsaCtfTool <arguments>
git clone https://github.com/Ganapati/RsaCtfTool.git
sudo apt-get install libgmp3-dev libmpc-dev
cd RsaCtfTool
pip3 install -r "requirements.txt"
python3 RsaCtfTool.py
git clone https://github.com/Ganapati/RsaCtfTool.git
sudo dnf install gcc python3-devel python3-pip python3-wheel gmp-devel mpfr-devel libmpc-devel
cd RsaCtfTool
pip3 install -r "requirements.txt"
python3 RsaCtfTool.py
If you also want the optional SageMath you need to do
sudo dnf install sagemath
pip3 install -r "optional-requirements.txt"
If pip3 install -r "requirements.txt"
fails to install requirements accessible within environment, the following command may work.
easy_install `cat requirements.txt`