2007-02-04 01:55:01 +00:00
|
|
|
module Msf
|
|
|
|
module Ui
|
|
|
|
module Gtk2
|
|
|
|
|
2007-02-04 21:25:10 +00:00
|
|
|
##
|
2007-02-04 01:55:01 +00:00
|
|
|
# This class help us to retreive all glade widgets and place them in your user instance
|
|
|
|
# like @windows, @widget, ...
|
2007-02-04 21:25:10 +00:00
|
|
|
##
|
2007-02-04 01:55:01 +00:00
|
|
|
class MyGlade
|
|
|
|
include Msf::Ui::Gtk2::MyControls
|
|
|
|
|
|
|
|
def initialize(root)
|
|
|
|
# Give the glade file and instance the glade object
|
2007-02-04 19:30:49 +00:00
|
|
|
file_glade = File.join(driver.resource_directory, 'msfgui.glade')
|
2007-02-04 01:55:01 +00:00
|
|
|
glade = GladeXML.new(file_glade, root) { |handler|method(handler) }
|
|
|
|
|
|
|
|
# For all widget names, instance a variable
|
|
|
|
glade.widget_names.each do |name|
|
|
|
|
begin
|
|
|
|
instance_variable_set("@#{name}".intern, glade[name])
|
|
|
|
rescue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-02-04 21:25:10 +00:00
|
|
|
##
|
|
|
|
# This is the main class
|
|
|
|
##
|
2007-02-04 01:55:01 +00:00
|
|
|
class MyApp < MyGlade
|
|
|
|
|
|
|
|
include Msf::Ui::Gtk2::MyControls
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super('window')
|
|
|
|
|
|
|
|
# Set a default icon for all widgets
|
|
|
|
Gtk::Window.set_default_icon(driver.get_icon('msfwx.xpm'))
|
|
|
|
@window.set_icon(driver.get_icon('msfwx.xpm'))
|
|
|
|
|
|
|
|
# Set a title with the version
|
|
|
|
@window.set_title("MSF Gui v#{Msf::Framework::Version}")
|
|
|
|
|
|
|
|
# Destroy
|
|
|
|
@window.signal_connect('destroy') { Gtk.main_quit }
|
|
|
|
|
|
|
|
# Default size
|
2007-02-04 21:25:10 +00:00
|
|
|
# @window.set_default_size(1024, 768)
|
2007-02-04 01:55:01 +00:00
|
|
|
|
|
|
|
# Defaults policies for Gtk::ScrolledWindow
|
|
|
|
@scrolledwindow1.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
|
|
@scrolledwindow2.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
|
|
@scrolledwindow3.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
2007-03-08 22:44:55 +00:00
|
|
|
# @scrolledwindow4.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
2007-02-04 01:55:01 +00:00
|
|
|
@scrolledwindow16.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
|
|
|
|
|
|
# Logs Buffer
|
|
|
|
@buffer = Gtk::TextBuffer.new
|
2007-02-04 21:25:10 +00:00
|
|
|
@viewlogs.set_buffer(@buffer_logs)
|
|
|
|
@viewlogs.set_editable(false)
|
|
|
|
@viewlogs.set_cursor_visible(false)
|
2007-02-04 01:55:01 +00:00
|
|
|
|
|
|
|
# Sessions Tree
|
2007-02-11 08:57:43 +00:00
|
|
|
@session_tree = MySessionTree.new(@treeview_session)
|
2007-02-04 01:55:01 +00:00
|
|
|
|
|
|
|
# Target Tree
|
2007-02-26 23:19:59 +00:00
|
|
|
@job_tree = MyJobTree.new(@treeview2)
|
2007-02-04 01:55:01 +00:00
|
|
|
|
|
|
|
# Module Tree
|
2007-02-13 18:02:56 +00:00
|
|
|
@module_tree = MyModuleTree.new(@treeview1, @viewmodule)
|
2007-02-11 08:57:43 +00:00
|
|
|
|
|
|
|
# Configure the window handles for easy reference
|
2007-03-08 22:44:55 +00:00
|
|
|
$gtk2driver.main = @window
|
2007-02-11 08:57:43 +00:00
|
|
|
$gtk2driver.session_tree = @session_tree
|
2007-02-26 23:19:59 +00:00
|
|
|
$gtk2driver.job_tree = @job_tree
|
2007-02-11 08:57:43 +00:00
|
|
|
$gtk2driver.module_tree = @module_tree
|
|
|
|
$gtk2driver.log_text = @viewlogs
|
2007-02-04 01:55:01 +00:00
|
|
|
|
2007-02-13 00:22:05 +00:00
|
|
|
# Initialize the search class
|
2007-02-13 09:14:02 +00:00
|
|
|
ModuleSearch.new(@search_entry, @search_button, @search_cancel_button)
|
2007-02-13 00:22:05 +00:00
|
|
|
|
2007-02-13 17:04:16 +00:00
|
|
|
# Focus on the search widget
|
|
|
|
@search_entry.can_focus = true
|
|
|
|
@search_entry.grab_focus
|
|
|
|
|
2007-02-04 01:55:01 +00:00
|
|
|
# Update the StatusBar with all framework modules
|
2007-02-04 19:30:49 +00:00
|
|
|
refresh()
|
2007-02-04 01:55:01 +00:00
|
|
|
|
|
|
|
# TODO: Add an hook for binding all links with browser preference
|
|
|
|
# Gtk::AboutDialog.set_url_hook do |about, link|
|
|
|
|
# puts link
|
|
|
|
# end
|
|
|
|
end
|
2007-02-04 19:30:49 +00:00
|
|
|
|
2007-02-04 21:25:10 +00:00
|
|
|
#
|
|
|
|
# Signal to refresh the treeview module
|
|
|
|
#
|
2007-02-04 19:30:49 +00:00
|
|
|
def on_refresh_activate
|
|
|
|
refresh()
|
|
|
|
end
|
2007-02-04 21:25:10 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bye bye
|
|
|
|
#
|
2007-02-04 19:30:49 +00:00
|
|
|
def on_leave_activate
|
2007-02-04 01:55:01 +00:00
|
|
|
Gtk.main_quit
|
|
|
|
end
|
2007-02-04 19:30:49 +00:00
|
|
|
|
2007-04-22 00:01:56 +00:00
|
|
|
#
|
|
|
|
# Actions for OpCodes/Stats
|
|
|
|
#
|
|
|
|
def on_stats_activate
|
|
|
|
MsfOpcode::Stats.new()
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Locales
|
|
|
|
#
|
|
|
|
def on_locales_activate
|
2007-04-22 13:56:47 +00:00
|
|
|
MsfOpcode::Locales.new()
|
2007-04-22 00:01:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Metatypes
|
|
|
|
#
|
|
|
|
def on_metatypes_activate
|
2007-04-22 18:53:58 +00:00
|
|
|
MsfOpcode::Metatypes.new()
|
2007-04-22 00:01:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Groups
|
|
|
|
#
|
|
|
|
def on_groups_activate
|
2007-04-22 19:01:13 +00:00
|
|
|
MsfOpcode::Groups.new()
|
2007-04-22 00:01:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Types
|
|
|
|
#
|
|
|
|
def on_types_activate
|
2007-04-22 19:14:00 +00:00
|
|
|
MsfOpcode::Types.new()
|
2007-04-22 00:01:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Platforms
|
|
|
|
#
|
|
|
|
def on_platforms_activate
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Modules
|
|
|
|
#
|
|
|
|
def on_modules_activate
|
|
|
|
MsfOpcode::Modules.new()
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Actions for OpCodes/Search
|
|
|
|
#
|
|
|
|
def on_search_activate
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2007-03-24 22:56:59 +00:00
|
|
|
#
|
|
|
|
# Action for "Parameters/Preferences"
|
|
|
|
#
|
2007-03-19 23:15:49 +00:00
|
|
|
def on_preferences_activate
|
2007-03-24 22:56:59 +00:00
|
|
|
MsfParameters::Preferences.new()
|
2007-03-19 23:15:49 +00:00
|
|
|
end
|
|
|
|
|
2007-03-24 22:56:59 +00:00
|
|
|
#
|
|
|
|
# Action for "Parameters"/"Databases" menu
|
|
|
|
#
|
|
|
|
def on_databases_activate
|
|
|
|
MsfParameters::Databases.new()
|
2007-02-04 01:55:01 +00:00
|
|
|
end
|
2007-02-04 19:30:49 +00:00
|
|
|
|
2007-03-25 21:44:48 +00:00
|
|
|
#
|
|
|
|
# Action for "Parameters"/"Options" menu
|
|
|
|
#
|
|
|
|
def on_options_activate
|
|
|
|
MsfParameters::Options.new()
|
|
|
|
end
|
2007-02-04 21:25:10 +00:00
|
|
|
#
|
|
|
|
# The About Dialog
|
|
|
|
#
|
2007-02-04 01:55:01 +00:00
|
|
|
def on_about_activate
|
|
|
|
MyAbout.new
|
|
|
|
end
|
|
|
|
|
2007-02-04 21:25:10 +00:00
|
|
|
#
|
|
|
|
# Call the refresh method to reload all module
|
|
|
|
#
|
2007-02-04 19:30:49 +00:00
|
|
|
def refresh
|
|
|
|
@module_tree.refresh
|
2007-02-04 01:55:01 +00:00
|
|
|
context_id = @statusbar.get_context_id("update")
|
|
|
|
@statusbar.push(
|
|
|
|
context_id,
|
|
|
|
"Loaded " +
|
|
|
|
framework.stats.num_exploits.to_s + " exploits, " +
|
|
|
|
framework.stats.num_payloads.to_s + " payloads, " +
|
|
|
|
framework.stats.num_encoders.to_s + " encoders, " +
|
|
|
|
framework.stats.num_nops.to_s + " nops, and " +
|
|
|
|
framework.stats.num_auxiliary.to_s + " auxiliary"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|