Hackvent_2018/Teaser/decode.py

59 lines
1.5 KiB
Python
Raw Normal View History

2018-12-04 12:54:01 +01:00
#!/usr/bin/python
from PIL import Image
# Load Image
im = Image.open('Teaser.png')
offsetX = 154
offsetY = 183
imageSize = 180
# Crop Image
im.crop((offsetX, offsetY, offsetX+imageSize, offsetY+imageSize)).save("data.png")
# Braillecode
string = "http://bit.ly/2TJvxHt"
# forwared to https://hackvent.hacking-lab.com/T34s3r_MMXVIII/index.php?flag=UI18-GAUa-lXhq-htyV-w2Wr-0yiV
# decoded ROT13: https://hackvent.hacking-lab.com/T34s3r_MMXVIII/index.php?flag=HV18-TNHn-yKud-uglI-j2Je-0lvI
# Second Image
im = Image.open('Teaser2.png')
im.crop((offsetX, offsetY, offsetX+imageSize, offsetY+imageSize)).save("data2.png")
# follow the white rabbit ...
# rushed by ...
# HACKvent 2018
2018-12-04 17:22:53 +01:00
# pdf file name: ZOoxjUSe1OVB7OPoVrsX
2018-12-04 12:54:01 +01:00
# .... ...- .---- ---.. -....- --. --- .-. .. -....- --.. .-. ... -... -....- ..- ..-. .- . -....- - ... -.... -.-. -....- -.-. ...- - -
# Morse code: HV18-GORI-ZRSB-UFAE-TS6C-CVTT
im = Image.open('pdf_data.png')
pix = im.load()
size = im.size
2018-12-04 17:22:53 +01:00
# Count Pixel types
2018-12-05 12:58:22 +01:00
pixels = {}
2018-12-04 17:22:53 +01:00
for x in range(size[0]):
for y in range(size[1]):
p = pix[x,y]
if p not in pixels:
2018-12-05 12:58:22 +01:00
pixels[p] = 1
else:
pixels[p] += 1
2018-12-04 17:22:53 +01:00
2018-12-05 12:58:22 +01:00
for p in pixels:
print(p, pixels[p])
2018-12-04 17:22:53 +01:00
# Filter
# for p in pixels:
# im = Image.open('pdf_data.png')
# pix = im.load()
# for x in range(size[0]):
# for y in range(size[1]):
# if p != pix[x,y]:
# pix[x,y] = (255,255,255,255)
2018-12-04 12:54:01 +01:00
#
2018-12-04 17:22:53 +01:00
# im.save('pdf_data_decrypted_%d-%d-%d.png' % (p[0], p[1], p[2]))