Created
October 13, 2014 10:54
-
-
Save volpino/7fc2fac39217624c0b60 to your computer and use it in GitHub Desktop.
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
| 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