- connect the remove_session to the on_close_session (framework_event_manager)

git-svn-id: file:///home/svn/framework3/trunk@4359 4d416f70-5f16-0410-b530-b9f4589650da
unstable
fab 2007-02-11 22:08:24 +00:00
parent 4d205cdcd8
commit c545082fc6
2 changed files with 28 additions and 6 deletions

View File

@ -362,6 +362,8 @@ end #class MyTargetTree
class MySessionTree
ID_SESSION, PEER, PAYLOAD, O_SESSION, BUFFER, PIPE, INPUT, OUTPUT = *(0..8).to_a
include Msf::Ui::Gtk2::MyControls
def initialize(treeview)
@treeview = treeview
@model = Gtk::ListStore.new(String, # Session ID
@ -432,6 +434,12 @@ class MySessionTree
separator1 = Gtk::SeparatorMenuItem.new
@menu_session.append(separator1)
close_session_item_shell = Gtk::ImageMenuItem.new("Close Session")
close_session_image_shell = Gtk::Image.new
close_session_image_shell.set(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)
close_session_item_shell.set_image(close_session_image_shell)
@menu_session.append(close_session_item_shell)
@menu_session.show_all
# TreeView signals
@ -458,6 +466,12 @@ class MySessionTree
end
end
close_session_item_shell.signal_connect('activate') do |item|
if session_iter = @selection.selected
framework.events.on_session_close(session_iter)
end
end
end # def initialize
def add_session(session)
@ -465,6 +479,14 @@ class MySessionTree
iter[ID_SESSION] = session.sid.to_s
iter[O_SESSION] = session
end
#
# Remove the session when receive the on_session_close from framework_event_manager
#
def remove_session(session_iter)
puts session_iter[O_SESSION]
@model.remove(session_iter)
end
end # class MySessionTree
end

View File

@ -40,14 +40,14 @@ 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
def on_session_close(session_iter)
$gtk2driver.session_tree.remove_session(session_iter)
# if (session.interacting == true)
# output.print_line
# end
# If logging had been enabled for this session, stop it now.
Msf::Logging::stop_session_log(session)
# Msf::Logging::stop_session_log(session)
end
end