0
点赞
收藏
分享

微信扫一扫

攻防世界 · RSA · wp

云卷云舒xj 2022-04-14 阅读 70
网络安全

题目来源:攻防世界​(题目 (xctf.org.cn))

 分析一下附件​

 不要直接双击,右键查看文件​

 发现有一个key,打开​

 

内容很熟悉,像上次的pem文件的公钥

改后缀,pem,用openssl打开

rsa -pubin -text -modulus -in gy.pem

 

e=65537

n=A9BD4C7A7763370A042FE6BEC7DDC841602DB942C7A362D1B5D372A4D08912D9(十六进制)

n=76775333340223961139427050707840417811156978085146970312315886671546666259161(十进制)

p=[273821108020968288372911424519201044333](http://www.factordb.com/index.php?id=1100000001249442187)

q=[280385007186315115828483000867559983517](http://www.factordb.com/index.php?id=1100000001249442188)

d=641719850703289443903401044513538529374868421789506745000371474906521949559

走一遍脚本

import gmpy2
import rsa
p = 273821108020968288372911424519201044333
q = 280385007186315115828483000867559983517
n = 76775333340223961139427050707840417811156978085146970312315886671546666259161
e = 65537
d = int(gmpy2.invert(e,(p-1)*(q-1)))
privatekey = rsa.PrivateKey(n,e,d,p,q)
with open("fllllllag.txt","rb") as f:
print(rsa.decrypt(f.read(),privatekey).decode())

直接得出flag,注意提交有坑

知识点:rsa

​所用到的工具在以往的文章有提及

举报

相关推荐

0 条评论