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
| import socket import os password = {3329: '0', 1498: '1', 2937: '2', 3041: '3', 2514: '4', 3406: '5', 3151: '6', 2137: '7', 3751: '8', 3063: '9', 2354: 'a', 3027: 'b', 2447: 'c', 3036: 'd', 2923: 'e', 2119: 'f', 4152: 'g', 3223: 'h', 1881: 'i', 3391: 'k', 2655: 'j', 1770: 'l', 4275: 'm', 2822: 'n', 2601: 'o', 3264: 'p', 3148: 'q', 1868: 'r', 2283: 's', 1592: 't', 2763: 'u', 2061: 'v', 3550: 'w', 2683: 'x', 2739: 'y', 2726: 'z'}
def sent_captcha(s, captcha): captcha = captcha + '\n' s.send(captcha.encode('utf-8'))
def rev_captcha(s): f = open('captcha.txt', 'w', encoding='utf-8') captcha = '' while True: d = s.recv(1024).decode('utf-8') print(d) captcha += d if 'your captcha' in d: f.write(captcha) return captcha elif '{' in d: return True elif 'bad' in d or 'time' in d: os._exit()
def solve_captache(context): if 'unCAPTCHA' not in context: context = 'A 20 rounds unCAPTCHA to get your flag! you may need a wider screen...\n' + context f = context.split('\n') captcha = [] flag = 0 for text in f: if 'unCAPTCHA' in text: flag = 1 elif flag == 1 and 'your captcha' not in text: captcha.append(text.strip('\n')) if 'your captcha' in text: flag = 0 ans = [] while True: try: captcha.remove('') except: break su = 0 for i in range(len(captcha[0])): tmp = 0 for x in captcha: if x[i] != ' ': tmp += ord(x[i]) if tmp != 0: su += tmp if tmp == 0 and su != 0: ans.append(su) su = 0 a = ''.join(list(map(lambda x: password[x], ans))) print(a) return a
if __name__ == '__main__': s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('210.32.4.14', 13373)) while True: res = rev_captcha(s) if res == True: break else: ans = solve_captache(res) sent_captcha(s, ans)
|