2007-05-28 14:12:17 +00:00
|
|
|
module Msf
|
|
|
|
module Ui
|
|
|
|
module Gtk2
|
|
|
|
|
|
|
|
class MsfWindow
|
|
|
|
|
|
|
|
#
|
2007-12-31 16:56:25 +00:00
|
|
|
# This class is dedicated to output auxiliary modules
|
2007-05-28 14:12:17 +00:00
|
|
|
#
|
|
|
|
class Auxiliary < Msf::Ui::Gtk2::SkeletonBasic
|
|
|
|
|
|
|
|
include Msf::Ui::Gtk2::MyControls
|
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
def initialize(title, data)
|
2007-05-28 18:26:31 +00:00
|
|
|
console_style = File.join(driver.resource_directory, 'style', 'console.rc')
|
|
|
|
Gtk::RC.parse(console_style)
|
2007-05-28 21:23:40 +00:00
|
|
|
|
2007-05-28 14:12:17 +00:00
|
|
|
# call the parent
|
|
|
|
super(title)
|
|
|
|
|
|
|
|
# Define the size and border
|
|
|
|
set_default_size(400, 400)
|
|
|
|
set_border_width(10)
|
|
|
|
|
|
|
|
# Main hbox
|
|
|
|
vbox = Gtk::VBox.new(false, 0)
|
|
|
|
add(vbox)
|
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
# Description
|
|
|
|
@r_buffer = SkeletonTextBuffer.new()
|
|
|
|
@r_view = Gtk::TextView.new(@r_buffer)
|
|
|
|
@r_view.set_size_request(400, 70)
|
|
|
|
r_sw = Gtk::ScrolledWindow.new()
|
|
|
|
r_sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
|
|
vbox.pack_start(r_sw, false, false, 0)
|
|
|
|
r_sw.add(@r_view)
|
|
|
|
|
|
|
|
# Live log
|
|
|
|
@buffer = SkeletonTextBuffer.new
|
|
|
|
@view = Gtk::TextView.new(@buffer)
|
2007-05-28 14:12:17 +00:00
|
|
|
sw = Gtk::ScrolledWindow.new()
|
|
|
|
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
|
|
vbox.pack_start(sw, true, true, 0)
|
|
|
|
sw.add(@view)
|
2007-05-28 18:26:31 +00:00
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
append_review(title, data)
|
2007-05-28 14:12:17 +00:00
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
# Return window
|
2007-05-28 14:12:17 +00:00
|
|
|
return self
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Adds text to the main logging screen
|
|
|
|
#
|
|
|
|
def append_log_view(data)
|
2007-05-28 21:23:40 +00:00
|
|
|
|
2007-05-28 14:12:17 +00:00
|
|
|
if (not @buffer.get_mark('end_mark'))
|
|
|
|
@buffer.create_mark('end_mark', @buffer.end_iter, false)
|
|
|
|
end
|
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
@buffer.insert_with_tags(@buffer.end_iter, Time.now.strftime("%H:%m:%S "), 'forestgreen_bold')
|
|
|
|
@buffer.insert_with_tags(@buffer.end_iter, Rex::Text.to_utf8(data), 'white_wrap')
|
|
|
|
|
2007-12-31 16:56:25 +00:00
|
|
|
# scroll to the end
|
2007-05-28 14:12:17 +00:00
|
|
|
@buffer.move_mark('end_mark', @buffer.end_iter)
|
|
|
|
@view.scroll_mark_onscreen(@buffer.get_mark('end_mark'))
|
|
|
|
end
|
|
|
|
|
2007-05-28 21:23:40 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
#
|
|
|
|
# Describe the auxiliary options
|
|
|
|
#
|
|
|
|
def append_review(aux, data)
|
|
|
|
@r_buffer.delete(*@r_buffer.bounds)
|
|
|
|
start = @r_buffer.get_iter_at_offset(0)
|
|
|
|
|
|
|
|
# Module name
|
|
|
|
@r_buffer.insert_with_tags(start, aux + "\n", 'forestgreen_bold_center')
|
|
|
|
|
|
|
|
# Pair key => Value
|
|
|
|
data.each do |key, value|
|
|
|
|
@r_buffer.insert_with_tags(start, "#{key}", 'rosybrown_bold')
|
|
|
|
@r_buffer.insert_with_tags(start, " => #{value}\n", 'white_bold')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-05-28 14:12:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|