Progress?
This commit is contained in:
39
Day 4/decode.py
Normal file → Executable file
39
Day 4/decode.py
Normal file → Executable file
@@ -1,23 +1,11 @@
|
||||
#!/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';
|
||||
length = len(s)
|
||||
|
||||
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
|
||||
# xxxx-xxxx-xxxx-xxxx
|
||||
correctKey = "00000000"
|
||||
@@ -26,12 +14,35 @@ for i in range(4):
|
||||
key = ord(s[pos]) ^ ord('-')
|
||||
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(data)
|
||||
print(f)
|
||||
|
||||
js = ""
|
||||
for i in range(len(data)):
|
||||
js += "document.getElementById('pirate%02d').value='%s';\n" % (i + 1, data[i])
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user