Created
June 16, 2019 09:04
-
-
Save saru2017/b5daf3c18de9dda195f1979ce9cdac8e to your computer and use it in GitHub Desktop.
CTF: pwn05
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys, os, tempfile, subprocess | |
data = input(">").strip() | |
if len(data) > 12: | |
print("too large file") | |
exit(-1) | |
with tempfile.TemporaryDirectory() as dirname: | |
name = os.path.join(dirname, "user") | |
f = open(name, "w") | |
f.write(data) | |
f.close() | |
os.chmod(name, 0o500) | |
print(subprocess.check_output(name).decode()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment