SHARE
TWEET

Untitled

a guest Apr 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from socket import socket
  2.  
  3. nums = []
  4.  
  5. def recv(sock):
  6.     try: data = sock.recv(1024).decode()
  7.     except: data = ""
  8.     print(data)
  9.     return data
  10.  
  11. while True:
  12.     sock = socket()
  13.     sock.settimeout(0.1)
  14.     try:
  15.         sock.connect(('archive.sunshinectf.org', 19004))
  16.     except:
  17.         print("Could not connect... retrying")
  18.         sock.close()
  19.         continue
  20.     print(recv(sock))
  21.     print(recv(sock))
  22.     for index, num in enumerate(nums):
  23.         print(str(num)+", "+str(index)+"/"+str(len(nums)))
  24.         sock.send((num+"\n").encode('utf-8'))
  25.         congratsText = recv(sock)
  26.         congratsText += recv(sock)
  27.     sock.send("0\n".encode('utf-8'))
  28.     sock.settimeout(0.3)
  29.     resp = recv(sock)
  30.     sock.settimeout(0.1)
  31.     givenNum = resp.split("\n")[0]
  32.     if givenNum.isdigit():
  33.         nums.append(resp.split("\n")[0])
  34.         print("Current:"+', '.join(nums))
  35.     else:
  36.         print("Error in response:"+givenNum)
  37.     sock.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top