Skip to content

Instantly share code, notes, and snippets.

@jlsajfj
Last active February 22, 2021 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsajfj/60d9abd25d0decfb9c37a50b5196c9ec to your computer and use it in GitHub Desktop.
Save jlsajfj/60d9abd25d0decfb9c37a50b5196c9ec to your computer and use it in GitHub Desktop.

Tenable 2021 CTF Rabbit Hole

This was fun.

Basically you start by navigating to the start page. This has some text like shown below.

initial

You drop that code back into the url and it navigates to the next. This keeps going until eventually it just has end.

Now what do you do with the text?

I realized it look like an index and a hex, so I tested that. My code below inserts all values into a dictionary, then outputs them all in the end. It creates a hex file first then converts it to a byte file. Here's what you get:

flag

Happy hacking!

page = 'http://167.71.246.232:8080/rabbit_hole.php?page='
cur = 'cE4g5bWZtYCuovEgYSO1'

import requests
import collections

c = {}

first = cur
r = requests.get(page+cur)
t = r.text

def process(c):
 out = ""
 for _ in range(max(k for k, v in c.items())+1):
  if _ in c:
   out += c[_]
 open('rabbithole.hex','w').write(out)

while t != 'end':
    var = t.split()
    c[int(var[0][1:-1])] = var[1][1:-2]
    cur = var[2]
    r = requests.get(page+cur)
    t = r.text

process(c)
open('rabbithole.png','wb').write(bytes.fromhex(open('rabbithole.hex','r').read()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment