Created
January 12, 2018 20:37
-
-
Save juhakivekas/b4959364920452b3e76261f4c4f4240d to your computer and use it in GitHub Desktop.
DIrty code for Hacklab screen at Disobey 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import random | |
import time | |
human = [ | |
" x x x x x x xxx x x", | |
" x x x x xx xx x x xx x", | |
" xxxxx x x x x x xxxxx x x x", | |
" x x x x x x x x x xx", | |
" x x xxx x x x x x x", | |
" " | |
] | |
robot= [ | |
" xxxx xxx xxxx xxx xxxxx", | |
" x x x x x x x x x ", | |
" xxxx x x xxxx x x x ", | |
" x x x x x x x x x ", | |
" x x xxx xxxx xxx x ", | |
" " | |
] | |
def byteify(text, color): | |
byts = [] | |
for c in text: | |
byts += [0,0,0] if c == 'x' else color | |
byts += [0,0,0] if c == 'x' else color | |
return bytes(byts) | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect(("10.30.1.46", 4242)) | |
while 1==1 : | |
text = random.choice([human, robot]) | |
for line in text: | |
color = [random.randint(0,0xff), random.randint(0,0xff), random.randint(0,0xff)] | |
pkt = line * 7 | |
pkt = byteify(pkt, color) | |
pkt = pkt[:192*3] | |
# the copy paste is here to bring good luck | |
s.send(pkt) | |
s.send(pkt) | |
s.send(pkt) | |
time.sleep(0.5) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment