Skip to content

Instantly share code, notes, and snippets.

@juhakivekas
Created January 12, 2018 20:37
Show Gist options
  • Save juhakivekas/b4959364920452b3e76261f4c4f4240d to your computer and use it in GitHub Desktop.
Save juhakivekas/b4959364920452b3e76261f4c4f4240d to your computer and use it in GitHub Desktop.
DIrty code for Hacklab screen at Disobey 2018
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