Created
June 16, 2019 14:40
-
-
Save saru2017/5a228a1c29f4bec3012541b0a6c6ce17 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