TimisoaraCTF2018-ForeignLanguage

Question

1
2
3
4
Here's one of my favorite words:
da}}rilwwe00yt____mfotfysf__11ty11mg__lphyer__tyrt33__algv33uc44nrgely44ys____mvozfpsw__11tv11mf{{letsfmmgcutbic

Download: [haforli.zip](haforli.zip)

Solution

一爆開個zip見到有好多python dependency, 咁應該係python script但係用exe pack起左。
直接unpack佢先

1
python3 python_exe_unpack.py ./haforli.exe

然後拎到個script (原本條script唔係咁既 , d variable用晒oOOooOOooo之類 , 下面係我改過之後既版本)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# uncompyle6 version 2.11.5
# Python bytecode 3.4 (3310)
# Decompiled from: Python 3.4.4 (default, Jan 5 2016, 15:35:18)
# [GCC 5.3.1 20160101]
# Embedded file name: haforli.py
# Compiled at: 2018-04-19 10:18:21
# Size of source mod 2**32: 198 bytes

import sys
import random
import string

welcomeText = "\n\n __ _ _ \n /\\ /\\__ _ / _| ___ _ __| (_)\n / /_/ / _` | |_ / _ \\| '__| | |\n/ __ / (_| | _| (_) | | | | |\n\\/ /_/ \\__,_|_| \\___/|_| |_|_|\n \n"

ooOO00oOo = lambda OOOo0: (True if len(OOOo0) % 2 == 1 else False)

def o0O():
print('Input an English word to be translated into a Haforli word: ')
inputWord = raw_input().strip().split(' ')[0]
reversedWord = inputWord[::-1]
Ooo = ''
o0oOoO00o = len(reversedWord) - 1 if ooOO00oOo(reversedWord) else len(reversedWord)
print o0oOoO00o
for i in range(0, o0oOoO00o, 2):
Ooo += reversedWord[i + 1] + reversedWord[i]

if ooOO00oOo(reversedWord):
Ooo += reversedWord[-1]
print Ooo
output = ''
for s in Ooo:
if not s.isalpha():
output += s + s
elif s.isupper():
output += s + random.choice(string.ascii_uppercase)
else:
output += s + random.choice(string.ascii_lowercase)


print('Your translated word: {0}'.format(output))

if __name__ == '__main__':
print(welcomeText)
o0O()

咁就睇應該都係可逆既 , 所以就寫左下面條script解

1
2
3
4
5
6
7
8
9
10
11
12
13
def decrypt(enc):
enc = enc[::-1]
tmp = ""
out = ""
for i in range(1, len(enc), 2):
tmp += enc[i]
for i in range(0, len(tmp), 2):
try:
out += tmp[i+1] + tmp[i]
except:
out += tmp[i]
return out
print decrypt("da}}rilwwe00yt____mfotfysf__11ty11mg__lphyer__tyrt33__algv33uc44nrgely44ys____mvozfpsw__11tv11mf{{letsfmmgcutbic")

Flag

1
timctf{l1m1ts_of_my_l4ngu4g3_ar3_the_l1m1ts_of_my_w0rld}