box of blink -- 35C3 CTF
box of blink
by bsdinis and goulov
Points: 72 (Dynamic, 80 solves)
Description:
As every year, can you please decode this for me?
Given:
Jupyter notebook with solution:
import csv
with open('blink.csv', 'rb') as csvfile: # just delete the header of the file by hand
temp = csv.reader(csvfile, delimiter=',', quotechar=';')
oe = []
lat = []
clk = []
e = []
d = []
c = []
b = []
a = []
data1 = []
data2 = []
for row in temp:
oe.append(row[1])
lat.append(row[2])
clk.append(row[3])
e.append(row[4])
d.append(row[5])
c.append(row[6])
b.append(row[7])
a.append(row[8])
data1.append(row[-1])
data2.append(row[-2])
rows = [int("".join([e[i],d[i],c[i],b[i],a[i]]),2) for i in range(len(e))]
def getline(start, rawclock):
line = []
state = 0
for i,c in enumerate(rawclock):
if state == 0:
if c == '1':
state = 1
line.append(dt[start+ i])
elif state == 1:
if c == '0':
state = 0
return line
screens = [(0,760000),(770000,1817000),(1824000,2871000),(2875000,3922000),(3931000,4977000),(4989000,6035000),(6035000,7081000),(7096000,8142000),(8148000,9194000),(9203000,9985000)]
for i in [(770000,1817000)]: #screens:
ct = clk[i[0]:i[1]]
lt = lat[i[0]:i[1]]
rt = rows[i[0]:i[1]]
dt = data1[i[0]:i[1]]
starts = []
prev = lt[0]
for i in range(len(lt)):
if lt[i] == '1' and prev == '0':
starts.append(i)
prev = lt[i]
#print starts
#print len(starts)
lines = []
for start in starts:
lines.append(''.join(getline(start, ct[start:start+5000])).replace('0',' ').replace('1','█'))
print '\n'.join(lines)
██████ ██████ ████ ██████ █████ █ █ ██ █████ █ ██████
█ █ █ █ █ █ █ ██ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █
█ █ ███ █ █ █ █ █ █ ████ █ ███ █ █ █ ███ █ █ █ █ ███
███ ██ █ █ ███ █ █ █ █ █ █ ██ █ █ █ ██ █ █ █ ███ ██ █
█ █ █ █ █ █ █ █ ██ █ █ █ █ █ █ ███ █ █ █
█ █ █ █ █ █ ██████ ██ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ ██ █ █ █ █ █ █ █ █ █ █ █
████ ████ ████ ████ █████ █ ████ █ ███ █████ █████ █ █ █ █ ████ █ █
██████ ██████
█ █ █ ██████ █
█ ██ █ █ █ ██ █
█ █ █ █ █ █ █ █ █
█ █ ████ █ ███ ████ █ █ ███ █ ████ ████ ████ ████
█ █ █ █ ██ █ █ ███ ██ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ ██ █ ██ █ █
█ █ █ █ █ █ █ █ █ █ ██ █ ██ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
██████ █████ ████ █ █ ███ ████ █ █ █████ ████ ███ ████ ████
██████ ██████ ██████
█ ██████ █ █
█ █ █ ██
█ █ █ █ █
█ █ █ █ █ ███ ███ █ █ █ ███ █ ███ █ █ █ ███
█ █ █ █ ██ █ █ ██ ███ █ █ ██ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ ██████ █
█ █ █ █ ██ █ █ █ ██ █ █ █ ██ █ █ █