rsapwn [Misc]

rsapwn

We must train the next generation of hackers.

Netcat: nc challenges.tamuctf.com 8573

Recon

Connecting to the service it asks us to factorize a number into two primes.

We must train future hackers to break RSA quickly. Here is how this will work.
I will multiply together two big primes (<= 10000000), give you the result,
and you must reply to me in less than two seconds telling me what primes I
multiplied.

Press enter when you are ready.
99990320174231

We'll use http://factordb.com for this challenge.

Code

from pwn import *
from factordb.factordb import FactorDB

s = remote("challenges.tamuctf.com", 8573)
print s.recvuntil("Press enter when you are ready.")
s.send("\n")
s.recvline()
num = int(s.recvline().strip())
print num
f = FactorDB(num)
f.connect()
pq = f.get_factor_list()
s.send(str(pq[0]) + " " + str(pq[1]) + "\n")

print s.recvline()
print s.recvline()
print s.recvline()

Flag

gigem{g00d_job_yOu_h4aaxx0rrR}