Progress?

This commit is contained in:
Roman Hergenreder 2018-12-04 17:22:53 +01:00
parent dd508a8100
commit 433ed832e0
5 changed files with 46 additions and 27 deletions

39
Day 4/decode.py Normal file → Executable file

@ -1,23 +1,11 @@
#!/usr/bin/python #!/usr/bin/python
pirates = ['0' for i in range(48)] # URL: https://hackvent.hacking-lab.com/Pirates_123/
p = ''.join(pirates)
s = '::)"<.vd]!&a{":r>Qyh 7'; s = '::)"<.vd]!&a{":r>Qyh 7';
length = len(s) length = len(s)
f='HV18-'; f='HV18-';
def subnum(i):
return int(p[i*2:i*2+2])
for i in range(length):
a = ord(s[i])
b = subnum(i)
f += chr(a ^ b)
print(f)
# indizes: 4, 9, 14, 19 # indizes: 4, 9, 14, 19
# xxxx-xxxx-xxxx-xxxx # xxxx-xxxx-xxxx-xxxx
correctKey = "00000000" correctKey = "00000000"
@ -26,12 +14,35 @@ for i in range(4):
key = ord(s[pos]) ^ ord('-') key = ord(s[pos]) ^ ord('-')
correctKey += "%02d%s" % (key, "00000000") correctKey += "%02d%s" % (key, "00000000")
data = [correctKey[i:i+4] for i in range(0, len(correctKey), 4)] for i in range(length):
a = ord(s[i])
b = int(correctKey[i*2:i*2+2])
f += chr(a ^ b)
upperBytes = ["15", "17"]
lowerBytes = ["12", "84"]
data = [correctKey[i:i+4] for i in range(0, len(correctKey), 4)]
print(correctKey) print(correctKey)
print(data) print(data)
print(f)
js = "" js = ""
for i in range(len(data)): for i in range(len(data)):
js += "document.getElementById('pirate%02d').value='%s';\n" % (i + 1, data[i]) js += "document.getElementById('pirate%02d').value='%s';\n" % (i + 1, data[i])
print(js) print(js)
# Barbados: 1717, 1718
# https://www.the-pirate-ship.com/majorstedebonnett
# Jamaica: 1688, (1674), 1721
# https://www.the-pirate-ship.com/sirhenrymorgan
# https://www.the-pirate-ship.com/maryread
# Tortuga: (1635, 1668, 1660)
# https://www.the-pirate-ship.com/L_Olonnais
# 000000001700008400121500000015001700008400000000
# 000000001700000000120000000015000000008400000000

30
Teaser/decode.py Normal file → Executable file

@ -25,23 +25,31 @@ im.crop((offsetX, offsetY, offsetX+imageSize, offsetY+imageSize)).save("data2.pn
# rushed by ... # rushed by ...
# HACKvent 2018 # HACKvent 2018
# pdf file name: ZOoxjUSe1OVB7OPoVrsX
# .... ...- .---- ---.. -....- --. --- .-. .. -....- --.. .-. ... -... -....- ..- ..-. .- . -....- - ... -.... -.-. -....- -.-. ...- - - # .... ...- .---- ---.. -....- --. --- .-. .. -....- --.. .-. ... -... -....- ..- ..-. .- . -....- - ... -.... -.-. -....- -.-. ...- - -
# Morse code: HV18-GORI-ZRSB-UFAE-TS6C-CVTT # Morse code: HV18-GORI-ZRSB-UFAE-TS6C-CVTT
im = Image.open('pdf_data.png') im = Image.open('pdf_data.png')
pix = im.load() pix = im.load()
size = im.size size = im.size
# pixels = [] # 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.append(p)
print(pixels)
# Filter
# for p in pixels:
# im = Image.open('pdf_data.png')
# pix = im.load()
# for x in range(size[0]): # for x in range(size[0]):
# for y in range(size[1]): # for y in range(size[1]):
# if p != pix[x,y]:
# pix[x,y] = (255,255,255,255)
# #
# if pix[x,y] not in pixels: # im.save('pdf_data_decrypted_%d-%d-%d.png' % (p[0], p[1], p[2]))
# pixels.append(pix[x,y])
#
# r = 255 - pix[x,y][0]
# g = 255 - pix[x,y][1]
# b = 255 - pix[x,y][2]
# pix[x,y] = (r,g,b,255)
# im.save('pdf_data_decrypted.png')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

BIN
Teaser/pdf_decrypted.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

BIN
Teaser/pdf_overlay.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB