For this challenge, we’re presented with a Python script. When you run the script, the only output you receive is this:

python h0ggle.py

You fell into a pit and died… of dysentery.

Looking at the script, it appears to base64 decode the data and decrypt it before passing it to exec() function. The data is rather large, with over one million characters. It’s using AES for the encryption from the Crypto.Cipher suite and stepping through it with a debugger shows that it continues this iteration process where each blob of data executed contains the same code with a new blob of data.

Following this line of logic, we can quickly script out this process. We’ll write each decrypted section to a new file and include the headers necessary to run it again, so on and so forth, until we reach the end.

First, we’ll create header.txt with the following data:

from Crypto.Cipher import AES as tiywynstbg
import base64 as ufjliotyds
import itertools as abtwsjxzys
from itertools import cycle, izip
def gasfewfesafds(message, key):
    return .join(chr(ord(c)^ord(k)) for c,k in abtwsjxzys.izip(message, abtwsjxzys.cycle(key)))

Next, we’ll put together a one-liner to traverse the dark depths of Python and see where it leads.

cp h0ggle.py h0ggle_1.py; for i in $(seq 1 50); do sed -e
's/exec(/print(/g' h0ggle_$i.py > temp; mv temp h0ggle_$i.py;
python h0ggle_$i.py > temp; cat header.txt temp >
h0ggle_$((i+1)).py; done

We run into a syntax error on file h0ggle_28.py, which shows our dysentery error message.

File “h0ggle_28.py”, line 8

You fell into a pit and died… of dysentery.

Looking at h0ggle_27.py we can see how to safely cross the river!

Key = PAN{all_dir3ctionz_l3ad_n0wh3r3}