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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| import websocket import pickle
nginx_status_codes = [ 100, 101, 200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 426, 500, 501, 502, 503, 504, 505 ]
res_dict=dict() ws = websocket.WebSocket()
while True: ws.connect('ws://game.ctf.seusus.com:54782/ws') result = str(ws.recv()) print(result) if result not in res_dict: print("not in!") print(res_dict) res_dict[result]="" ws.close() i=0 while True: ws.connect('ws://game.ctf.seusus.com:54782/ws') res=str(ws.recv()) if res!= result: ws.close() continue else: ws.send(str(nginx_status_codes[i])) res2=str(ws.recv()) if 'Wrong answer!' not in res2: print("++") res_dict[result]=nginx_status_codes[i] print("ok!") break else: print(str(nginx_status_codes[i])+" false") i+=1 if i>41: ws.close() break else: print("in!!!") with open("res_dict.pkl","wb") as f: pickle.dump(res_dict,f) continue
|