Created
July 31, 2017 11:21
-
-
Save 0xPwny/1ac0fd69af49bbe1b5bb040581c552b2 to your computer and use it in GitHub Desktop.
Bugs Bunny CTF 2017 - Baby RSA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Bugs_Bunny CTF 2107 | |
import libnum | |
r = open("enc.txt","rb") | |
f = r.read().split('\n') | |
flag = "" | |
for c in f: | |
n =20473673450356553867543177537 | |
p = 2165121523231 | |
q = 9456131321351327 | |
e = 17 | |
phi = (p-1) * (q - 1) | |
d = libnum.invmod(e,phi) | |
m = pow(int(c),d,n) | |
flag += "".join(libnum.n2s(m)) | |
if "}" in flag: | |
print"FLAG : %s\n"% flag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment