making shit pimp
git-svn-id: file:///home/svn/incoming/trunk@2773 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
3d976dc22c
commit
47bfe4de3a
|
@ -12,10 +12,12 @@ class Core
|
||||||
|
|
||||||
include Msf::Ui::Console::CommandDispatcher
|
include Msf::Ui::Console::CommandDispatcher
|
||||||
|
|
||||||
|
# Session command options
|
||||||
@@session_opts = Rex::Parser::Arguments.new(
|
@@session_opts = Rex::Parser::Arguments.new(
|
||||||
"-i" => [ true, "Interact with the supplied session identifier." ],
|
"-i" => [ true, "Interact with the supplied session identifier." ],
|
||||||
"-h" => [ false, "Help banner." ],
|
"-h" => [ false, "Help banner." ],
|
||||||
"-l" => [ false, "List all active sessions." ])
|
"-l" => [ false, "List all active sessions." ],
|
||||||
|
"-q" => [ false, "Quiet mode." ])
|
||||||
|
|
||||||
# Returns the list of commands supported by this command dispatcher
|
# Returns the list of commands supported by this command dispatcher
|
||||||
def commands
|
def commands
|
||||||
|
@ -231,23 +233,20 @@ class Core
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@@session_opts.parse(args) { |opt, idx, val|
|
method = nil
|
||||||
sid = nil
|
quiet = false
|
||||||
|
sid = nil
|
||||||
|
|
||||||
|
# Parse the command options
|
||||||
|
@@session_opts.parse(args) { |opt, idx, val|
|
||||||
case opt
|
case opt
|
||||||
|
when "-q"
|
||||||
|
quiet = true
|
||||||
|
|
||||||
# Interact with the supplied session identifier
|
# Interact with the supplied session identifier
|
||||||
when "-i"
|
when "-i"
|
||||||
if ((session = framework.sessions.get(val)))
|
method = 'interact'
|
||||||
if (session.interactive?)
|
sid = val
|
||||||
print_status("Starting interaction with #{session.name}...\n")
|
|
||||||
|
|
||||||
session.interact
|
|
||||||
else
|
|
||||||
print_error("Session #{val} is non-interactive.")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print_error("Invalid session identifier: #{val}")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Display the list of active sessions
|
# Display the list of active sessions
|
||||||
when "-l"
|
when "-l"
|
||||||
|
@ -263,6 +262,32 @@ class Core
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Now, perform the actual method
|
||||||
|
case method
|
||||||
|
when 'interact'
|
||||||
|
if ((session = framework.sessions.get(sid)))
|
||||||
|
if (session.interactive?)
|
||||||
|
print_status("Starting interaction with #{session.name}...\n") if (quiet == false)
|
||||||
|
|
||||||
|
# Set the session's input and output handles
|
||||||
|
session.linput = driver.input
|
||||||
|
session.loutput = driver.output
|
||||||
|
|
||||||
|
# Interact
|
||||||
|
session.interact()
|
||||||
|
|
||||||
|
# Once interact returns, swap the output handle with a
|
||||||
|
# none output
|
||||||
|
session.loutput = Rex::Ui::Output::None.new
|
||||||
|
else
|
||||||
|
print_error("Session #{sid} is non-interactive.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print_error("Invalid session identifier: #{sid}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
rescue
|
rescue
|
||||||
log_error("Session manipulation failed: #{$!}")
|
log_error("Session manipulation failed: #{$!}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -107,17 +107,13 @@ class Exploit
|
||||||
# If we were given a session, let's see what we can do with it
|
# If we were given a session, let's see what we can do with it
|
||||||
if (session)
|
if (session)
|
||||||
# If we aren't told to run in the background and the session can be
|
# If we aren't told to run in the background and the session can be
|
||||||
# interacted with, start interacting with it
|
# interacted with, start interacting with it by issuing the session
|
||||||
|
# interaction command.
|
||||||
if (bg == false and session.interactive?)
|
if (bg == false and session.interactive?)
|
||||||
# Set the session's input and output handles
|
driver.run_single("session -q -i #{session.sid}")
|
||||||
session.linput = driver.input
|
|
||||||
session.loutput = driver.output
|
|
||||||
|
|
||||||
# Interact
|
|
||||||
session.interact()
|
|
||||||
# Otherwise, log that we created a session
|
# Otherwise, log that we created a session
|
||||||
else
|
else
|
||||||
print_status("Session #{session.id} created.")
|
print_status("Session #{session.sid} created.")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print_status("Exploit completed, no session was created.")
|
print_status("Exploit completed, no session was created.")
|
||||||
|
|
Loading…
Reference in New Issue