Ubuntu下RsaCtfTool的安装及使用

栏目: Python · 发布时间: 7年前

内容简介:在CTF比赛中,往往会涉及到RSA解密类的题目,有了这个工具(基于python2.x)做起来就得心应手了。在下载前建议把ubuntu源设置为aliyun,速度谁用谁知道。

前言

在CTF比赛中,往往会涉及到RSA解密类的题目,有了这个工具(基于 python 2.x)做起来就得心应手了。

Ubuntu下RsaCtfTool的安装及使用

0×1 安装

在下载前建议把ubuntu源设置为aliyun,速度谁用谁知道。

使用命令行:

git clone <a href="https://github.com/Ganapati/RsaCtfTool.git" ref="nofollow">https://github.com/Ganapati/RsaCtfTool.git</a> 

或者去github下载zip包解压:

Ubuntu下RsaCtfTool的安装及使用

cd RsaCtfTool  //进入这个目录

安装python第三方库

pip install -r requirements.txt

其实是这4个(PyCrypto,GMPY2,SymPy,requests) python库,在安装GMPY2,SymPY的时候会报错,因为有些环境还要下载:

mpfr,The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
v=4.0.1
wget http://www.mpfr.org/mpfr-current/mpfr-${v}.tar.bz2
tar -jxvf mpfr-${v}.tar.bz2 && cd mpfr-${v}
./configure
make && make check && make install

下载编译大概要10多分钟:

Ubuntu下RsaCtfTool的安装及使用 到这里就是mpfr安装完成了。

接下来下载MPC:

v=1.1.0
wget ftp://ftp.gnu.org/gnu/mpc/mpc-${v}.tar.gz
tar -zxvf mpc-${v}.tar.gz && cd mpc-${v}
./configure
make && make check && make install

Ubuntu下RsaCtfTool的安装及使用 要注意的是一定要先安装好mpfr,才能安装MPC,不然会报这个错误:

configure: error: libmpfr not found or uses a different ABI (including static vs shared) 

大概也是10分钟左右。

参考: https://www.cnblogs.com/pcat/p/5746821.html

这时可以再次进入CtfRsaTool目录,再次运行 pip install -r requirements.txt ,就能成功安装python第三方依赖了。

Ubuntu下RsaCtfTool的安装及使用 接下来就可以愉快的使用RsaCtfTool.py了。

0×2 使用

使用 python RsaCtfTool.py 去执行,如果./RsaCtfTool.py执行会报Crypto库不存在。

Ubuntu下RsaCtfTool的安装及使用 用法一:已知公钥(自动求私钥) –publickey,密文 —-uncipherfile。

这里有一道rsa的ctf题目: https://pan.baidu.com/s/1-LenHQbB9MJ30HhrScYLcQ

将文件解压复制到RsaCtfTool里:

python RsaCtfTool.py --publickey 公钥文件 --uncipherfile 加密的文件

Ubuntu下RsaCtfTool的安装及使用 用法二:已知公钥求私钥。

>RsaCtfTool.py --publickey 公钥文件 --private

Ubuntu下RsaCtfTool的安装及使用 用法三:密钥格式转换

把PEM格式的公钥转换为n,e

>python RsaCtfTool.py --dumpkey --key 公钥文件

Ubuntu下RsaCtfTool的安装及使用

把n,e转换为PEM格式

python RsaCtfTool.py --createpub -n 782837482376192871287312987398172312837182 -e 65537

Ubuntu下RsaCtfTool的安装及使用 项目地址参考: https://github.com/Ganapati/RsaCtfTool


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Neural Networks for Applied Sciences and Engineering

Neural Networks for Applied Sciences and Engineering

Samarasinghe, Sandhya / CRC Pr I Llc / 2006-9 / $ 118.59

In response to the exponentially increasing need to analyze vast amounts of data, Neural Networks for Applied Sciences and Engineering: From Fundamentals to Complex Pattern Recognition provides scient......一起来看看 《Neural Networks for Applied Sciences and Engineering》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具