Russian Doll — Write up (HeroCTF)

Brijesharun Gurumurthy
2 min readApr 26, 2021

This is my write-up for the ‘Russian Doll’ Challenge in HeroCTF 2021

Part 1: Assessing the given material:

Russian Doll Challenge Description.

We are given a zip file, upon inspection, it’s a never-ending loop of folders nested into each folder just like a Russian Doll!

To get the flag inside this zip we will be writing a script to loop through the zip and get only the contents inside.

Part 2:

I have written a simple Python code that loops through the zip and extracts only the text file to a given location.

import os
import shutil
import zipfile
my_dir = r"./fileexport"
my_zip = r"./archive.zip"
with zipfile.ZipFile(my_zip) as zip_file:
for member in zip_file.namelist():
filename = os.path.basename(member)
# skip directories
if not filename:
continue

# copy file (taken from zipfile's extract)
source = zip_file.open(member)
target = open(os.path.join(my_dir, filename), "wb")
with source, target:
shutil.copyfileobj(source, target)

Saved the python script in the same file as the zip.

Upon running the script we get two files, with one being the flag!

And with that, the challenge is complete!

My connections:

Github

Linkedin

--

--

Brijesharun Gurumurthy

Web UI Developer 👾 JavaScript & Python Dev with passion for Cyber Sec.