Skip to content

Instantly share code, notes, and snippets.

@0xPwny
Created July 31, 2017 11:21
Show Gist options
  • Save 0xPwny/1ac0fd69af49bbe1b5bb040581c552b2 to your computer and use it in GitHub Desktop.
Save 0xPwny/1ac0fd69af49bbe1b5bb040581c552b2 to your computer and use it in GitHub Desktop.
Bugs Bunny CTF 2017 - Baby RSA
#!/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