Skip to content

Instantly share code, notes, and snippets.

@auser
Last active May 5, 2021 18:52
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 auser/fad9748128b3aef8f153d3fdb2760fa0 to your computer and use it in GitHub Desktop.
Save auser/fad9748128b3aef8f153d3fdb2760fa0 to your computer and use it in GitHub Desktop.
cycler==0.10.0
kiwisolver==1.3.1
matplotlib==3.3.4
numpy==1.19.5
Pillow==8.2.0
pyparsing==2.4.7
python-dateutil==2.8.1
six==1.16.0
import zipfile, argparse, os, shutil
import matplotlib.pyplot as plt
import numpy as np
parser = argparse.ArgumentParser(description="Steno ctf")
parser.add_argument('--image', required=True, help='path to image')
args = parser.parse_args()
src_dir = os.getcwd()
src = os.path.join(src_dir, args.image)
dest = os.path.join(src_dir, args.image + '.zip')
shutil.copy(src, dest)
with zipfile.ZipFile(dest, "r") as ref:
ref.extractall(src_dir)
coord = np.genfromtxt('./paint_it_black.txt', delimiter=',')
out = np.zeros(shape=(90,90))
x, y = coord.T[0], coord.T[-1]
plt.scatter(x, y)
plt.savefig(os.path.join(src_dir, 'pass.jpeg'))
print("""
Read pass.jpeg for the password to unzip flag.zip
```
unzip flag.zip
```
""")
p = input("Enter password: ")
with zipfile.ZipFile(os.path.join(src_dir, "flag.zip")) as ref:
ref.extractall(src_dir, pwd=bytes(p, 'utf-8'))
with open('flag.txt', 'r') as f:
content = f.read()
print("content: {}".format(content))
# Cleanup
os.unlink('./flag.txt')
os.unlink('./flag.zip')
os.unlink('./pass.jpeg')
os.unlink('./paint_it_black.txt')
os.unlink(dest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment