Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import socket
s = socket.socket()
s.connect(("asis-ctf.ir", 12445))
s.recv(2048)
s.send("Paillier\n")
s.recv(2048)
lo = 10 ** 307
hi = 11 ** 307
while True:
n = (lo + hi) / 2
s.recv(2048)
print "Sending N={}".format(n)
s.sendall("E\n")
s.recv(2048)
s.sendall("{}\n".format(n))
result = s.recv(2048)
print result
if "None" in result:
print "GOT N: ", n+1
exit(0)
elif "Your secret is" in result:
print "TOO LOW!"
lo = n
else:
print "TOO HIGH!"
hi = n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.