add remove job after framework_event_manager opened a session only if exploit.passive? return fase
rename MyTargetTree by MyJobTree and all the attr_accessor reference git-svn-id: file:///home/svn/framework3/trunk@4479 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
9172103e01
commit
797badb271
|
@ -64,14 +64,14 @@ class MyApp < MyGlade
|
|||
@session_tree = MySessionTree.new(@treeview_session)
|
||||
|
||||
# Target Tree
|
||||
@target_tree = MyTargetTree.new(@treeview2)
|
||||
@job_tree = MyJobTree.new(@treeview2)
|
||||
|
||||
# Module Tree
|
||||
@module_tree = MyModuleTree.new(@treeview1, @viewmodule)
|
||||
|
||||
# Configure the window handles for easy reference
|
||||
$gtk2driver.session_tree = @session_tree
|
||||
$gtk2driver.target_tree = @target_tree
|
||||
$gtk2driver.job_tree = @job_tree
|
||||
$gtk2driver.module_tree = @module_tree
|
||||
$gtk2driver.log_text = @viewlogs
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class MsfAssistant
|
|||
|
||||
def initialize(active_module)
|
||||
@session_tree = $gtk2driver.session_tree
|
||||
@target_tree = $gtk2driver.target_tree
|
||||
@job_tree = $gtk2driver.job_tree
|
||||
@active_module = active_module
|
||||
|
||||
# initialize exploit driver's exploit instance
|
||||
|
@ -338,7 +338,7 @@ class MsfAssistant
|
|||
|
||||
begin
|
||||
@mydriver.run
|
||||
@target_tree.add_oneshot(@active_module)
|
||||
@job_tree.add_oneshot(@active_module, @hash["RHOST"])
|
||||
rescue ::Exception => e
|
||||
@pipe.print_error("Exploit failed: #{e}")
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Gtk2
|
|||
###
|
||||
class Driver < Msf::Ui::Driver
|
||||
|
||||
attr_accessor :session_tree, :module_tree, :target_tree, :log_text, :module_model
|
||||
attr_accessor :session_tree, :module_tree, :job_tree, :log_text, :module_model
|
||||
attr_accessor :module_completion
|
||||
|
||||
include Msf::Ui::Gtk2::FrameworkEventManager
|
||||
|
|
|
@ -264,8 +264,8 @@ class MyModuleTree < MyGlade
|
|||
end # Class MyExploitsTree
|
||||
|
||||
|
||||
class MyTargetTree < MyGlade
|
||||
PIX, TIME, NAME, OBJECT = *(0..4).to_a
|
||||
class MyJobTree < MyGlade
|
||||
PIX, TIME, NAME, OBJECT, RHOST, REFNAME = *(0..6).to_a
|
||||
|
||||
include Msf::Ui::Gtk2::MyControls
|
||||
|
||||
|
@ -274,8 +274,10 @@ class MyTargetTree < MyGlade
|
|||
|
||||
@model = Gtk::TreeStore.new(Gdk::Pixbuf, # Pix rhost
|
||||
String, # process TIME
|
||||
String, # exploit refname
|
||||
Object # Exploit Object
|
||||
String, # exploit shortname
|
||||
Object, # Exploit Object
|
||||
String, # Remote host
|
||||
String # exploit refname
|
||||
)
|
||||
|
||||
# Renderer
|
||||
|
@ -298,7 +300,7 @@ class MyTargetTree < MyGlade
|
|||
|
||||
# Name Gtk::TreeViewColumn
|
||||
column_name = Gtk::TreeViewColumn.new
|
||||
column_name.set_title("Payload")
|
||||
column_name.set_title("Module")
|
||||
column_name.pack_start(renderer_name, true)
|
||||
column_name.set_cell_data_func(renderer_name) do |column, cell, model, iter|
|
||||
cell.text = iter[NAME]
|
||||
|
@ -365,24 +367,34 @@ class MyTargetTree < MyGlade
|
|||
#
|
||||
# Add One Shot
|
||||
#
|
||||
def add_oneshot(exploit)
|
||||
def add_oneshot(exploit, rhost)
|
||||
time = Time.now
|
||||
oneshot_childiter = @model.append(@oneshot_iter)
|
||||
#oneshot_childiter.set_value(PIX, nil)
|
||||
oneshot_childiter.set_value(TIME, Time.now.strftime("%H:%m:%S"))
|
||||
oneshot_childiter.set_value(NAME, exploit.shortname)
|
||||
oneshot_childiter.set_value(OBJECT, exploit)
|
||||
oneshot_childiter.set_value(RHOST, rhost)
|
||||
oneshot_childiter.set_value(REFNAME, exploit.refname)
|
||||
@treeview2.expand_all()
|
||||
end
|
||||
|
||||
#
|
||||
# Remove Target
|
||||
# Remove Target if not a passive exploit
|
||||
#
|
||||
def remove_target(iter)
|
||||
@treeview2.model.remove(iter)
|
||||
def remove_job(rhost, name)
|
||||
found = nil
|
||||
@model.each do |model,path,iter|
|
||||
if (iter[RHOST] == rhost and iter[REFNAME] == name and iter[OBJECT].passive? == false)
|
||||
found = iter
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@model.remove(found) if found
|
||||
end
|
||||
|
||||
end #class MyTargetTree
|
||||
end #class MyJobTree
|
||||
|
||||
class MySessionTree
|
||||
ID_SESSION, PEER, PAYLOAD, O_SESSION = *(0..4).to_a
|
||||
|
|
|
@ -33,6 +33,10 @@ module FrameworkEventManager
|
|||
$gtk2driver.append_log_view("[*] Session #{session.sid} created for #{session.tunnel_peer}\n")
|
||||
Msf::Ui::Gtk2::Stream::Session.new($gtk2driver.session_tree, session)
|
||||
|
||||
# remove job if not a passive exploit
|
||||
rhost = session.tunnel_peer.split(':')[0]
|
||||
$gtk2driver.job_tree.remove_job(rhost, session.via_exploit)
|
||||
|
||||
if (Msf::Logging.session_logging_enabled? == true)
|
||||
Msf::Logging.start_session_log(session)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue