says the RSA

1. Analyze the
download link and find a public key file (e, n), and an encrypted file
2.
Public key file, a bunch of letters in it, and then Baidu later, only to know that you need to unlock n, e

Insert picture description here
index e, the modulus is n (hexadecimal)
3. Then decompose the prime number by n to get p, q, (it is really fragrant without writing a script)
Insert picture description here
4. Script decryption

import gmpy2
import rsa
e = 65537
n = 86934482296048119190666062003494800588905656017203025617216654058378322103517
p = 285960468890451637935629440372639283459
q = 304008741604601924494328155975272418463

fan = (q-1)*(p-1)
d = gmpy2.invert(e,fan)
key = rsa.PrivateKey(n, e, int(d), p, q)
f = open("flag.enc", "rb+")
fr = f.read()
print(rsa.decrypt(fr, key))

pit:之前写脚本定义rsa.py了,导致在运行时,发生了覆盖,就出现问题,改了文件名才成功运行

161 original articles published · Liked 14 · Visitors 7617

Guess you like

Origin blog.csdn.net/YenKoc/article/details/105276376