Session kill now works for the GUI
git-svn-id: file:///home/svn/framework3/trunk@4365 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
9d8fd125a6
commit
97a87f957f
|
@ -68,6 +68,12 @@ module CommandDispatcher
|
|||
#
|
||||
attr_accessor :driver
|
||||
|
||||
|
||||
#
|
||||
# The active, interactive session, if any
|
||||
#
|
||||
attr_accessor :active_session
|
||||
|
||||
end
|
||||
|
||||
###
|
||||
|
|
|
@ -634,6 +634,8 @@ class Core
|
|||
if (session.interactive?)
|
||||
print_status("Starting interaction with #{session.name}...\n") if (quiet == false)
|
||||
|
||||
self.active_session = session
|
||||
|
||||
# Set the session's input and output handles
|
||||
session.init_ui(driver.input.dup, driver.output)
|
||||
|
||||
|
@ -663,6 +665,9 @@ class Core
|
|||
log_error("Session manipulation failed: #{$!} #{$!.backtrace.inspect}")
|
||||
end
|
||||
|
||||
# Reset the active session
|
||||
self.active_session = nil
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
|
@ -328,12 +328,20 @@ class MsfAssistant
|
|||
|
||||
# Session registration is done by event handler
|
||||
# XXX: No output from the exploit when this is set!
|
||||
# @mydriver.use_job = true
|
||||
@mydriver.use_job = true
|
||||
|
||||
@pipe.create_subscriber_proc() do |msg|
|
||||
$stderr.puts "MSG: #{msg}"
|
||||
$gtk2driver.append_log_view(msg)
|
||||
end
|
||||
|
||||
Thread.new do
|
||||
0.upto(20) do |i|
|
||||
$pipe.print_status("I am alive at #{i}")
|
||||
select(nil, nil, nil, 1.0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@pipe.print_status("Launching exploit #{@mydriver.exploit.refname}...")
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ class MySessionTree
|
|||
|
||||
close_session_item_shell.signal_connect('activate') do |item|
|
||||
if session_iter = @selection.selected
|
||||
remove_session(session_iter)
|
||||
remove_session_iter(session_iter)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -481,17 +481,27 @@ class MySessionTree
|
|||
end
|
||||
|
||||
#
|
||||
# Remove the session when receive the on_session_close from framework_event_manager
|
||||
# Kill the session associated with this item
|
||||
#
|
||||
def remove_session_iter(iter)
|
||||
session.interacting = false if session.interactive?
|
||||
framework.events.on_session_close(iter[O_SESSION])
|
||||
remove_session(iter)
|
||||
iter[O_SESSION].kill
|
||||
end
|
||||
|
||||
def remove_session(iter)
|
||||
@model.remove(iter)
|
||||
#
|
||||
# This is called by on_session_close
|
||||
#
|
||||
def remove_session(session)
|
||||
found = nil
|
||||
@model.each do |model,path,iter|
|
||||
if (iter[ID_SESSION] == session.sid.to_s)
|
||||
found = iter
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@model.remove(found) if found
|
||||
end
|
||||
|
||||
end # class MySessionTree
|
||||
|
||||
end
|
||||
|
|
|
@ -41,10 +41,8 @@ module FrameworkEventManager
|
|||
# Called when a session is closed and removed from the framework.
|
||||
#
|
||||
def on_session_close(session)
|
||||
|
||||
if (session.interacting == true)
|
||||
output.print_line
|
||||
end
|
||||
|
||||
$gtk2driver.session_tree.remove_session(session)
|
||||
|
||||
# If logging had been enabled for this session, stop it now.
|
||||
Msf::Logging::stop_session_log(session)
|
||||
|
|
Loading…
Reference in New Issue