
This is a zip file within a zip file within a zip file…
We just need a Python program to unzip until there is no more unzipping to be done!
import zipfile
import os
def recursively_unzip(zip_file):
current_file = zip_file
while current_file.endswith('.zip'):
with zipfile.ZipFile(current_file, 'r') as zipf:
# Extract the content to the same directory
extracted_files = zipf.namelist()
zipf.extractall(os.path.dirname(current_file))
# Check for non-zip files and update the current file
if len(extracted_files) != 1:
print("Unexpected file structure. Multiple files in a zip.")
break
current_file = os.path.join(os.path.dirname(current_file), extracted_files[0])
if not current_file.endswith('.zip'):
print(f"Reached a non-zip file: {current_file}")
break
# Example usage:
recursively_unzip('flag.zip')
This will create a lot of files. Search for anything not ending in .zip
ls | grep -v zip
It’s an image, so open it in the file browser and you have the flag!