# Incognito wtfCTF 2021: H3ll0R3v

## H3ll0R3v

### Category: Reverse #### 100 points

Hello bois!

Author: Xyroscar

file: `Hello`

## Solution

Given file is a python bytecode.

``````file Hello.pyc
Hello.pyc: python 3.8 byte-compiled``````

I’ve used `uncompyle6` to get the source code as below.

``(ctf) [email protected]:~/tmp\$ uncompyle6 Hello ``
``````# uncompyle6 version 3.7.4
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.9.1+ (default, Feb  5 2021, 13:46:56)
# [GCC 10.2.1 20210110]
# Embedded file name: Hello.py
# Compiled at: 2021-05-19 07:23:46
# Size of source mod 2**32: 1923 bytes

def main(input):
j = -4
for c in input:
if j == 1:
if c != 'Z':
exit(43)
else:
if j == -7:
if c != 'w':
exit(133)
else:
if j == -5:
if c != 'f':
exit(42069)
else:
if j == -4:
if c != 'C':
exit(11037)
else:
if j == 7:
if c != 'R':
exit(9001)
else:
if j == -2:
if c != 'F':
exit(11037)
if j == -1 and c != '{':
exit(11037)
if j == 4 and c != '3':
exit(11037)
elif j == 0 and c != '3':
exit(11037)
else:
if j == -3:
if c != 'T':
exit(82)
if j == 2:
if c != '_':
exit(11037)
if j == -6:
if c != 't':
exit(133)
if j == 6:
if c != 'E':
exit(133)
elif j == 9 and c != '3':
exit(7223)
else:
if j == 3:
if c != 'R':
exit(133)
if j == 5:
if c != 'V':
exit(133)
if j == 8:
if c != '5':
exit(6738)
elif j == 10:
if c != '}':
exit(1111)
j += 1
else:
print('Hello World')
# okay decompiling Hello.pyc``````

I’ve made some changes in the code. Not sure if it’s `uncompyle6` thing or it was intended, but I had also correct some indentations. I’ve ended with below code, which gave me the flag.

``````def main(input):
j = -15
for c in input:
j += 1
if j == 1:
if c != 'Z':
print('Z', end='')
continue
if j == -7:
if c != 'w':
print('w', end='')
continue
if j == -5:
if c != 'f':
print('f', end='')
continue
if j == -4:
if c != 'C':
print('C', end='')
continue
if j == 7:
if c != 'R':
print('R', end='')
continue
if j == -2:
if c != 'F':
print('F', end='')
continue
if j == -1 and c != '{':
print('{', end='')
continue
if j == 4 and c != '3':
print('3', end='')
continue
if j == 0 and c != '3':
print('3', end='')
continue
if j == -3:
if c != 'T':
print('T', end='')
continue
if j == 2:
if c != '_':
print('_', end='')
continue
if j == -6:
if c != 't':
print('t', end='')
continue
if j == 6:
if c != 'E':
print('E', end='')
continue
if j == 9 and c != '3':
print('3', end='')
continue
if j == 3:
if c != 'R':
print('R', end='')
continue
if j == 5:
if c != 'V':
print('V', end='')
continue
if j == 8:
if c != '5':
print('5', end='')
continue
if j == 10:
if c != '}':
print('}', end='')
continue
else:
print('Hello World')

main('11111111111111111111111111111111111111111')``````

Output:

``wtfCTF{3Z_R3VER53}Hello World``

## Flag

`wtfCTF{3Z_R3VER53}`