Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- #! /bin/python
- import socket
- code_03 = {'100010100':'0','101001000':'1','101000100':'2','101000010':'3','100101000':'4','100100100':'5','100100010':'6','101010000':'7','100010010':'8','100001010':'9','110101000':'A','110100100':'B','110100010':'C','110010100':'D','110010010':'E','110001010':'F','101101000':'G','101100100':'H','101100010':'I','100110100':'J','100011010':'K','101011000':'L','101001100':'M','101000110':'N','100101100':'O','100010110':'P','110110100':'Q','110110010':'R','110101100':'S','110100110':'T','110010110':'U','110011010':'V','101101100':'W','101100110':'X','100110110':'Y','100111010':'Z', '101011110':'', '100101110':'-', '111010100':'.', '111010010':' ', '111001010':'$','101101110':'/','101110110':'+','110101110':'%','100100110':'$','111011010':'%','111010110':'/','100110010':'+'}
- HOST = "adctf2014.katsudon.org"
- PORT = 43010
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((HOST, PORT))
- while 1:
- data = s.recv(256) + s.recv(256)
- print data
- if '\xe2\x96\x8c' not in data:
- break
- char_codes = []
- text = ''
- data = data.replace(' ', ' ')
- for i in range(0, len(data)-3, 3):
- temp = data[i] + '' + '' + data[i+1] + '' + data[i+2]
- if temp == '\xe2\x96\x8c':
- text += '10'
- elif temp == '\xe2\x96\x88':
- text += '11'
- elif temp == '\xe2\x96\x90':
- text += '01'
- elif temp == ' ':
- text += '0'
- else:
- print "Error: ", temp
- print text
- out = ""
- for i in range(0, len(text)-9, 9):
- out += code_03[text[i:i+9]]
- print out[:-2]
- s.send(out[:-2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement