Zipped up
start = 1
import os
def unzip(filename):
os.system(f"unzip {filename}")
def untar(filename):
os.system(f"tar -zvjf {filename}")
def gunzip(filename):
os.system(f"tar -zvxf {filename}")
cur = start
while True:
files = os.listdir(str(cur))
file = next(filter(lambda x: '.txt' not in x, files)) # Ignore this monstrosity
file = os.path.join(str(cur),file)
if 'kz3' in file:
unzip(file)
elif 'bz2' in file:
untar(file)
else:
gunzip(file)
file = next(filter(lambda x: '.txt' in x, files)) # Again, ignore this monstrosity
os.system(f"cat {os.path.join(str(cur),file)} >> flags.txt") # Basically puts the text file into flags.txt
os.system(f"rm -rf {cur}") # Remove at your own risk, just cleans up and makes sure not to blow up your VM
cur += 1Last updated
Was this helpful?