Skip to content

Instantly share code, notes, and snippets.

@palloc
Created September 7, 2015 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palloc/11aee3af3ebd6a587569 to your computer and use it in GitHub Desktop.
Save palloc/11aee3af3ebd6a587569 to your computer and use it in GitHub Desktop.
Signer and Verifier
import struct
from socket import *
p = socket(AF_INET, SOCK_STREAM)
p.connect(("cry1.chal.mmactf.link",44816))
rcv = p.recv(1024)[333:]
num1 = int(temp) / 12
num2 = 12
n = 167891001700388890587843249700549749388526432049480469518286617353920544258774519927209158925778143308323065254691520342763823691453238628056767074647261280532853686188135635704146982794597383205258532849509382400026732518927013916395873932058316105952437693180982367272310066869071042063581536335953290566509
if num1 % num2 != 0:
print "error\n"
q = socket(AF_INET, SOCK_STREAM)
q.connect(("cry1.chal.mmactf.link",44815))
q.send(str(num1)+"\n")
ans1 = int(q.recv(4096))
print "ans1 = %d" % ans1
q.close()
q = socket(AF_INET, SOCK_STREAM)
q.connect(("cry1.chal.mmactf.link",44815))
q.send(str(num2)+"\n")
ans2 = int(q.recv(4096))
print "ans2 = %d" % ans2
q.close()
finans = ans1 * ans2 % n
print "final answer = %d" % finans
p.send(str(finans)+"\n")
print p.recv(4096)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment