Hackvent_2018/Teaser/decode.py
Roman Hergenreder ab0b694600 Progress
2018-12-05 12:58:22 +01:00

59 lines
1.5 KiB
Python
Executable File

#!/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
# pdf file name: ZOoxjUSe1OVB7OPoVrsX
# .... ...- .---- ---.. -....- --. --- .-. .. -....- --.. .-. ... -... -....- ..- ..-. .- . -....- - ... -.... -.-. -....- -.-. ...- - -
# Morse code: HV18-GORI-ZRSB-UFAE-TS6C-CVTT
im = Image.open('pdf_data.png')
pix = im.load()
size = im.size
# Count Pixel types
pixels = {}
for x in range(size[0]):
for y in range(size[1]):
p = pix[x,y]
if p not in pixels:
pixels[p] = 1
else:
pixels[p] += 1
for p in pixels:
print(p, pixels[p])
# 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)
#
# im.save('pdf_data_decrypted_%d-%d-%d.png' % (p[0], p[1], p[2]))