shell and meterpreter console signals
git-svn-id: file:///home/svn/framework3/trunk@5029 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
457b4eb8f3
commit
6096c4347a
|
@ -15,6 +15,7 @@ module Msf
|
||||||
session = iter[3]
|
session = iter[3]
|
||||||
super(iter)
|
super(iter)
|
||||||
|
|
||||||
|
# When the session type is meterperter
|
||||||
if (session.type == "meterpreter")
|
if (session.type == "meterpreter")
|
||||||
require 'msf/ui/gtk2/console/interactive_channel.rb'
|
require 'msf/ui/gtk2/console/interactive_channel.rb'
|
||||||
|
|
||||||
|
@ -41,8 +42,28 @@ module Msf
|
||||||
self.insert_text(Rex::Text.to_utf8(data))
|
self.insert_text(Rex::Text.to_utf8(data))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# When the close button was clicked ...
|
||||||
|
self.button_close.signal_connect('clicked') do
|
||||||
|
begin
|
||||||
|
iter[4] = nil
|
||||||
|
p.channel.close
|
||||||
|
session.sys.process.kill(p.pid)
|
||||||
|
self.destroy
|
||||||
|
session.channels.each_pair { |cid, channel|
|
||||||
|
puts "#{cid}: #{channel.class.cls}"
|
||||||
|
}
|
||||||
|
rescue IOError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Interact with the supplied channel
|
# Interact with the supplied channel
|
||||||
meterconsole.interact_with_channel(p.channel, @pipe)
|
meterconsole.interact_with_channel(p.channel, @pipe)
|
||||||
|
|
||||||
|
else
|
||||||
|
# Bind the signal to the close button
|
||||||
|
self.button_close.signal_connect('clicked') do
|
||||||
|
self.close_console
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,8 +83,6 @@ module Msf
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
class Meterpreter < Msf::Ui::Gtk2::SkeletonConsole
|
class Meterpreter < Msf::Ui::Gtk2::SkeletonConsole
|
||||||
#require 'msf/ui/gtk2/console/interactive_channel.rb'
|
|
||||||
|
|
||||||
def initialize(iter)
|
def initialize(iter)
|
||||||
# meterpreter client
|
# meterpreter client
|
||||||
session = iter[3]
|
session = iter[3]
|
||||||
|
@ -72,7 +91,6 @@ module Msf
|
||||||
super(iter)
|
super(iter)
|
||||||
|
|
||||||
meterconsole = Rex::Post::Meterpreter::Ui::Console.new(session)
|
meterconsole = Rex::Post::Meterpreter::Ui::Console.new(session)
|
||||||
# meterconsole.extend(Pipe)
|
|
||||||
|
|
||||||
# Create a new pipe to not use the pipe class
|
# Create a new pipe to not use the pipe class
|
||||||
@pipe = Rex::IO::BidirectionalPipe.new
|
@pipe = Rex::IO::BidirectionalPipe.new
|
||||||
|
|
|
@ -66,10 +66,10 @@ module Msf
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ID_SESSION, PEER, TYPE, O_SESSION = *(0..4).to_a
|
ID_SESSION, PEER, TYPE, O_SESSION, O_BUFFER = *(0..5).to_a
|
||||||
@@offset = 0
|
@@offset = 0
|
||||||
|
|
||||||
attr_accessor :type, :buffer
|
attr_accessor :type, :button_close
|
||||||
|
|
||||||
#
|
#
|
||||||
# Init the SkeletonConsole class
|
# Init the SkeletonConsole class
|
||||||
|
@ -98,7 +98,12 @@ module Msf
|
||||||
|
|
||||||
# Setup text view and buffer
|
# Setup text view and buffer
|
||||||
@textview = Gtk::TextView.new
|
@textview = Gtk::TextView.new
|
||||||
@buffer = Gtk::TextBuffer.new
|
if iter[O_BUFFER].nil?
|
||||||
|
@buffer = Gtk::TextBuffer.new
|
||||||
|
iter[O_BUFFER] = @buffer
|
||||||
|
else
|
||||||
|
@buffer = iter[O_BUFFER]
|
||||||
|
end
|
||||||
scrolled_window = Gtk::ScrolledWindow.new
|
scrolled_window = Gtk::ScrolledWindow.new
|
||||||
scrolled_window.add(@textview)
|
scrolled_window.add(@textview)
|
||||||
vbox.pack_start(scrolled_window, true, true, 5)
|
vbox.pack_start(scrolled_window, true, true, 5)
|
||||||
|
@ -113,13 +118,10 @@ module Msf
|
||||||
# Setup button close
|
# Setup button close
|
||||||
hbox = Gtk::HButtonBox.new
|
hbox = Gtk::HButtonBox.new
|
||||||
hbox.layout_style = Gtk::ButtonBox::END
|
hbox.layout_style = Gtk::ButtonBox::END
|
||||||
button = Gtk::Button.new(Gtk::Stock::CLOSE)
|
@button_close = Gtk::Button.new(Gtk::Stock::CLOSE)
|
||||||
button.signal_connect("clicked") do
|
|
||||||
close_console()
|
|
||||||
end
|
|
||||||
|
|
||||||
# Pack
|
# Pack
|
||||||
hbox.pack_end(button, false, false, 5)
|
hbox.pack_end(@button_close, false, false, 5)
|
||||||
vbox.pack_start(hbox, false, false, 0)
|
vbox.pack_start(hbox, false, false, 0)
|
||||||
|
|
||||||
# Signal for the Return key pressed
|
# Signal for the Return key pressed
|
||||||
|
|
|
@ -8,16 +8,18 @@ module Msf
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
class MySessionTree
|
class MySessionTree
|
||||||
ID_SESSION, PEER, TYPE, O_SESSION = *(0..4).to_a
|
ID_SESSION, PEER, TYPE, O_SESSION, O_BUFFER = *(0..5).to_a
|
||||||
|
|
||||||
include Msf::Ui::Gtk2::MyControls
|
include Msf::Ui::Gtk2::MyControls
|
||||||
|
|
||||||
def initialize(treeview)
|
def initialize(treeview)
|
||||||
@treeview = treeview
|
@treeview = treeview
|
||||||
@model = Gtk::ListStore.new(String, # Session ID
|
@model = Gtk::ListStore.new(
|
||||||
|
String, # Session ID
|
||||||
String, # IP Address
|
String, # IP Address
|
||||||
String, # Session Type
|
String, # Session Type
|
||||||
Object # Session Object
|
Object, # Session Object
|
||||||
|
Object # Gtk::TextBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
# Renderer
|
# Renderer
|
||||||
|
@ -107,6 +109,7 @@ module Msf
|
||||||
iter[TYPE] = session.type ? session.type : nil
|
iter[TYPE] = session.type ? session.type : nil
|
||||||
#iter[PAYLOAD] = session.via_payload ? session.via_payload : nil
|
#iter[PAYLOAD] = session.via_payload ? session.via_payload : nil
|
||||||
iter[O_SESSION] = session
|
iter[O_SESSION] = session
|
||||||
|
iter[O_BUFFER] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue