Add the splash screen, some reformatting
git-svn-id: file:///home/svn/framework3/trunk@5233 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
a233a9c29e
commit
dde128f52c
|
@ -1,259 +1,294 @@
|
||||||
module Msf
|
module Msf
|
||||||
module Ui
|
module Ui
|
||||||
module Gtk2
|
module Gtk2
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# This class help us to wait the next release of ruby-libglade2 package
|
# This class help us to wait the next release of ruby-libglade2 package
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
class GladeXML < GladeXML
|
class GladeXML < GladeXML
|
||||||
def connect(source, target, signal, handler, data, after = false)
|
def connect(source, target, signal, handler, data, after = false)
|
||||||
@handler_proc ||= Proc.new{}
|
|
||||||
handler = canonical_handler(handler)
|
|
||||||
if target
|
|
||||||
signal_proc = target.method(handler)
|
|
||||||
else
|
|
||||||
signal_proc = @handler_proc.call(handler)
|
|
||||||
end
|
|
||||||
|
|
||||||
if after
|
@handler_proc ||= Proc.new{}
|
||||||
sig_conn_proc = source.method(:signal_connect_after)
|
handler = canonical_handler(handler)
|
||||||
else
|
if target
|
||||||
sig_conn_proc = source.method(:signal_connect)
|
signal_proc = target.method(handler)
|
||||||
end
|
else
|
||||||
|
signal_proc = @handler_proc.call(handler)
|
||||||
|
end
|
||||||
|
|
||||||
if signal_proc
|
if after
|
||||||
guard_source_from_gc(source)
|
sig_conn_proc = source.method(:signal_connect_after)
|
||||||
case signal_proc.arity
|
else
|
||||||
when 0
|
sig_conn_proc = source.method(:signal_connect)
|
||||||
sig_conn_proc.call(signal) {signal_proc.call}
|
end
|
||||||
else
|
|
||||||
sig_conn_proc.call(signal, &signal_proc)
|
|
||||||
end
|
|
||||||
elsif $DEBUG
|
|
||||||
puts "Undefined handler: #{handler}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def guard_source_from_gc(source)
|
if signal_proc
|
||||||
return if source.nil?
|
guard_source_from_gc(source)
|
||||||
@sources ||= {}
|
case signal_proc.arity
|
||||||
@sources[source.object_id] = source
|
when 0
|
||||||
|
sig_conn_proc.call(signal) {signal_proc.call}
|
||||||
|
else
|
||||||
|
sig_conn_proc.call(signal, &signal_proc)
|
||||||
|
end
|
||||||
|
elsif $DEBUG
|
||||||
|
puts "Undefined handler: #{handler}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
source.signal_connect("destroy") do |object|
|
def guard_source_from_gc(source)
|
||||||
@sources.delete(object.object_id)
|
return if source.nil?
|
||||||
end
|
@sources ||= {}
|
||||||
|
@sources[source.object_id] = source
|
||||||
|
|
||||||
# To get the parent window of the source as a ruby object.
|
source.signal_connect("destroy") do |object|
|
||||||
# Ruby/GTK keeps the Window objects on the memory to prevend from GC.
|
@sources.delete(object.object_id)
|
||||||
parent = source.parent
|
end
|
||||||
while parent
|
|
||||||
parent = parent.parent
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
###
|
# To get the parent window of the source as a ruby object.
|
||||||
#
|
# Ruby/GTK keeps the Window objects on the memory to prevend from GC.
|
||||||
# This class help us to retreive all glade widgets and place them in your user instance
|
parent = source.parent
|
||||||
# like @windows, @widget, ...
|
while parent
|
||||||
#
|
parent = parent.parent
|
||||||
###
|
end
|
||||||
class MyGlade
|
end
|
||||||
include Msf::Ui::Gtk2::MyControls
|
end
|
||||||
|
|
||||||
def initialize(root)
|
###
|
||||||
# Give the glade file and instance the glade object
|
#
|
||||||
file_glade = File.join(driver.resource_directory, 'msfgui.glade')
|
# This class help us to retreive all glade widgets and place them in your user instance
|
||||||
glade = GladeXML.new(file_glade, root) { |handler|method(handler) }
|
# like @windows, @widget, ...
|
||||||
|
#
|
||||||
|
###
|
||||||
|
class MyGlade
|
||||||
|
include Msf::Ui::Gtk2::MyControls
|
||||||
|
|
||||||
# For all widget names, instance a variable
|
def initialize(root)
|
||||||
glade.widget_names.each do |name|
|
# Give the glade file and instance the glade object
|
||||||
begin
|
file_glade = File.join(driver.resource_directory, 'msfgui.glade')
|
||||||
instance_variable_set("@#{name}".intern, glade[name])
|
glade = GladeXML.new(file_glade, root) { |handler|method(handler) }
|
||||||
rescue
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
###
|
# For all widget names, instance a variable
|
||||||
#
|
glade.widget_names.each do |name|
|
||||||
# This class provides the main window.
|
begin
|
||||||
#
|
instance_variable_set("@#{name}".intern, glade[name])
|
||||||
###
|
rescue
|
||||||
class MyApp < MyGlade
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
include Msf::Ui::Gtk2::MyControls
|
###
|
||||||
|
#
|
||||||
|
# This class provides the splash screen
|
||||||
|
#
|
||||||
|
###
|
||||||
|
class MySplash < Gtk::Window
|
||||||
|
|
||||||
def initialize
|
include Msf::Ui::Gtk2::MyControls
|
||||||
# console_style = File.join(driver.resource_directory, 'style', 'main.rc')
|
|
||||||
# Gtk::RC.parse(console_style)
|
|
||||||
|
|
||||||
super('window')
|
def initialize
|
||||||
|
super(Gtk::Window::TOPLEVEL)
|
||||||
|
|
||||||
|
set_type_hint(Gdk::Window::TYPE_HINT_SPLASHSCREEN)
|
||||||
|
|
||||||
|
set_decorated(false)
|
||||||
|
set_window_position(Gtk::Window::POS_CENTER)
|
||||||
|
|
||||||
# Set a default icon for all widgets
|
set_default_size(460,301)
|
||||||
Gtk::Window.set_default_icon(driver.get_icon('msfwx.xpm'))
|
set_border_width(0)
|
||||||
@window.set_icon(driver.get_icon('msfwx.xpm'))
|
|
||||||
|
image = Gtk::Image.new(driver.get_icon("splash.png"))
|
||||||
|
image.queue_draw
|
||||||
|
add(image)
|
||||||
|
|
||||||
|
realize
|
||||||
|
|
||||||
|
show_all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Set a title with the version
|
|
||||||
@window.set_title("msfgui v#{Msf::Framework::Version}")
|
###
|
||||||
|
#
|
||||||
|
# This class provides the main window.
|
||||||
|
#
|
||||||
|
###
|
||||||
|
|
||||||
# Destroy
|
class MyApp < MyGlade
|
||||||
@window.signal_connect('destroy') { Gtk.main_quit }
|
|
||||||
|
|
||||||
# Default size
|
attr_accessor :window
|
||||||
# @window.set_default_size(1024, 768)
|
|
||||||
|
include Msf::Ui::Gtk2::MyControls
|
||||||
|
|
||||||
# Defaults policies for Gtk::ScrolledWindow
|
def initialize
|
||||||
@scrolledwindow_module.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
# console_style = File.join(driver.resource_directory, 'style', 'main.rc')
|
||||||
@scrolledwindow_jobs.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
# Gtk::RC.parse(console_style)
|
||||||
@scrolledwindow_session.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
||||||
@scrolledwindow_information.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
||||||
@scrolledwindow_logs.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
||||||
|
|
||||||
# Logs Buffer
|
super('window')
|
||||||
@buffer = Gtk::TextBuffer.new
|
|
||||||
@viewlogs.set_buffer(@buffer_logs)
|
|
||||||
@viewlogs.set_editable(false)
|
|
||||||
@viewlogs.set_cursor_visible(false)
|
|
||||||
|
|
||||||
# Sessions Tree
|
# Set a default icon for all widgets
|
||||||
@session_tree = MySessionTree.new(@treeview_session)
|
Gtk::Window.set_default_icon(driver.get_icon('msfwx.xpm'))
|
||||||
|
@window.set_icon(driver.get_icon('msfwx.xpm'))
|
||||||
|
|
||||||
# Target Tree
|
# Set a title with the version
|
||||||
@job_tree = MyJobTree.new(@treeview2)
|
@window.set_title("msfgui v#{Msf::Framework::Version}")
|
||||||
|
|
||||||
# Module Tree
|
# Destroy
|
||||||
@module_tree = MyModuleTree.new(@treeview1, @viewmodule)
|
@window.signal_connect('destroy') { Gtk.main_quit }
|
||||||
|
|
||||||
# Tooltips
|
# Default size
|
||||||
tooltips = Gtk::Tooltips.new
|
# @window.set_default_size(1024, 768)
|
||||||
|
|
||||||
# Configure the window handles for easy reference
|
# Defaults policies for Gtk::ScrolledWindow
|
||||||
$gtk2driver.main = @window
|
@scrolledwindow_module.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
$gtk2driver.session_tree = @session_tree
|
@scrolledwindow_jobs.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
$gtk2driver.job_tree = @job_tree
|
@scrolledwindow_session.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
$gtk2driver.module_tree = @module_tree
|
@scrolledwindow_information.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
$gtk2driver.log_text = @viewlogs
|
@scrolledwindow_logs.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
$gtk2driver.tips = tooltips
|
|
||||||
|
|
||||||
# Initialize the search class
|
# Logs Buffer
|
||||||
ModuleSearch.new(@search_entry, @search_button, @search_cancel_button)
|
@buffer = Gtk::TextBuffer.new
|
||||||
|
@viewlogs.set_buffer(@buffer_logs)
|
||||||
|
@viewlogs.set_editable(false)
|
||||||
|
@viewlogs.set_cursor_visible(false)
|
||||||
|
|
||||||
# Focus on the search widget
|
# Sessions Tree
|
||||||
@search_entry.can_focus = true
|
@session_tree = MySessionTree.new(@treeview_session)
|
||||||
@search_entry.grab_focus
|
|
||||||
|
|
||||||
# Update the StatusBar with all framework modules
|
# Target Tree
|
||||||
refresh()
|
@job_tree = MyJobTree.new(@treeview2)
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Module Tree
|
||||||
# Signal to refresh the treeview module
|
@module_tree = MyModuleTree.new(@treeview1, @viewmodule)
|
||||||
#
|
|
||||||
def on_refresh_activate
|
|
||||||
refresh()
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Tooltips
|
||||||
# Bye bye
|
tooltips = Gtk::Tooltips.new
|
||||||
#
|
|
||||||
def on_leave_activate
|
|
||||||
Gtk.main_quit
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Configure the window handles for easy reference
|
||||||
# Actions for OpCodes/Stats
|
$gtk2driver.main = @window
|
||||||
#
|
$gtk2driver.session_tree = @session_tree
|
||||||
def on_stats_activate
|
$gtk2driver.job_tree = @job_tree
|
||||||
MsfOpcode::Stats.new()
|
$gtk2driver.module_tree = @module_tree
|
||||||
end
|
$gtk2driver.log_text = @viewlogs
|
||||||
|
$gtk2driver.tips = tooltips
|
||||||
|
|
||||||
#
|
# Initialize the search class
|
||||||
# Actions for OpCodes/Locales
|
ModuleSearch.new(@search_entry, @search_button, @search_cancel_button)
|
||||||
#
|
|
||||||
def on_locales_activate
|
|
||||||
MsfOpcode::Locales.new()
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Focus on the search widget
|
||||||
# Actions for OpCodes/Metatypes
|
@search_entry.can_focus = true
|
||||||
#
|
@search_entry.grab_focus
|
||||||
def on_metatypes_activate
|
|
||||||
MsfOpcode::Metatypes.new()
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Update the StatusBar with all framework modules
|
||||||
# Actions for OpCodes/Groups
|
refresh()
|
||||||
#
|
end
|
||||||
def on_groups_activate
|
|
||||||
MsfOpcode::Groups.new()
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions for OpCodes/Types
|
# Signal to refresh the treeview module
|
||||||
#
|
#
|
||||||
def on_types_activate
|
def on_refresh_activate
|
||||||
MsfOpcode::Types.new()
|
refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions for OpCodes/Platforms
|
# Bye bye
|
||||||
#
|
#
|
||||||
def on_platforms_activate
|
def on_leave_activate
|
||||||
MsfOpcode::Platforms.new()
|
Gtk.main_quit
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions for OpCodes/Modules
|
# Actions for OpCodes/Stats
|
||||||
#
|
#
|
||||||
def on_modules_activate
|
def on_stats_activate
|
||||||
MsfOpcode::Modules.new()
|
MsfOpcode::Stats.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Actions for OpCodes/Search
|
# Actions for OpCodes/Locales
|
||||||
#
|
#
|
||||||
def on_search_activate
|
def on_locales_activate
|
||||||
end
|
MsfOpcode::Locales.new()
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Action for "Window/Logs" menu
|
# Actions for OpCodes/Metatypes
|
||||||
#
|
#
|
||||||
def on_logs_activate
|
def on_metatypes_activate
|
||||||
MsfWindow::Logs.new
|
MsfOpcode::Metatypes.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# The About Dialog
|
# Actions for OpCodes/Groups
|
||||||
#
|
#
|
||||||
def on_about_activate
|
def on_groups_activate
|
||||||
ad = MyAbout.new(@window)
|
MsfOpcode::Groups.new()
|
||||||
ad.signal_connect('response'){ ad.destroy }
|
end
|
||||||
ad.show
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Call the refresh method to reload all module
|
# Actions for OpCodes/Types
|
||||||
#
|
#
|
||||||
def refresh
|
def on_types_activate
|
||||||
@module_tree.refresh
|
MsfOpcode::Types.new()
|
||||||
context_id = @statusbar.get_context_id("update")
|
end
|
||||||
@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
|
# Actions for OpCodes/Platforms
|
||||||
|
#
|
||||||
|
def on_platforms_activate
|
||||||
|
MsfOpcode::Platforms.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Actions for OpCodes/Modules
|
||||||
|
#
|
||||||
|
def on_modules_activate
|
||||||
|
MsfOpcode::Modules.new()
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Actions for OpCodes/Search
|
||||||
|
#
|
||||||
|
def on_search_activate
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Action for "Window/Logs" menu
|
||||||
|
#
|
||||||
|
def on_logs_activate
|
||||||
|
MsfWindow::Logs.new
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# The About Dialog
|
||||||
|
#
|
||||||
|
def on_about_activate
|
||||||
|
ad = MyAbout.new(@window)
|
||||||
|
ad.signal_connect('response'){ ad.destroy }
|
||||||
|
ad.show
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Call the refresh method to reload all module
|
||||||
|
#
|
||||||
|
def refresh
|
||||||
|
@module_tree.refresh
|
||||||
|
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
|
end
|
||||||
|
|
|
@ -18,161 +18,176 @@ require 'msf/ui/gtk2/opcode'
|
||||||
require 'msf/ui/gtk2/framework_event_manager'
|
require 'msf/ui/gtk2/framework_event_manager'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Ui
|
module Ui
|
||||||
module Gtk2
|
module Gtk2
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# This class implements a user interface driver on a gtk2 interface.
|
# This class implements a user interface driver on a gtk2 interface.
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
class Driver < Msf::Ui::Driver
|
class Driver < Msf::Ui::Driver
|
||||||
|
|
||||||
# main view
|
# main view
|
||||||
attr_accessor :session_tree, :module_tree, :job_tree, :log_text, :module_model
|
attr_accessor :session_tree, :module_tree, :job_tree, :log_text, :module_model
|
||||||
attr_accessor :module_completion, :main, :tips
|
attr_accessor :module_completion, :main, :tips
|
||||||
|
|
||||||
include Msf::Ui::Gtk2::FrameworkEventManager
|
include Msf::Ui::Gtk2::FrameworkEventManager
|
||||||
|
|
||||||
ConfigCore = "framework/core"
|
ConfigCore = "framework/core"
|
||||||
ConfigGroup = "framework/ui/gtk2"
|
ConfigGroup = "framework/ui/gtk2"
|
||||||
|
|
||||||
#
|
#
|
||||||
# The default resource directory for msfgui
|
# The default resource directory for msfgui
|
||||||
#
|
#
|
||||||
DefaultResourceDirectory = Msf::Config.data_directory + File::SEPARATOR + "msfgui"
|
DefaultResourceDirectory = Msf::Config.data_directory + File::SEPARATOR + "msfgui"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initializes a gtk2 driver instance
|
# Initializes a gtk2 driver instance
|
||||||
#
|
#
|
||||||
def initialize(opts = {})
|
def initialize(opts = {})
|
||||||
# Call the parent
|
# Call the parent
|
||||||
super()
|
super()
|
||||||
|
|
||||||
# Set the passed options hash for referencing later on.
|
# Set the passed options hash for referencing later on.
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
|
|
||||||
# Initialize configuration
|
# Initialize configuration
|
||||||
Msf::Config.init
|
Msf::Config.init
|
||||||
|
|
||||||
# Initialize logging
|
# Initialize logging
|
||||||
initialize_logging
|
initialize_logging
|
||||||
|
|
||||||
# Initialize attributes
|
# Initialize attributes
|
||||||
self.framework = Msf::Simple::Framework.create
|
self.framework = Msf::Simple::Framework.create
|
||||||
|
|
||||||
# Create the gtk2driver global
|
# Create the gtk2driver global
|
||||||
$gtk2driver = self
|
$gtk2driver = self
|
||||||
|
|
||||||
# Init GTK2
|
# Init GTK2
|
||||||
Gtk.init
|
Gtk.init
|
||||||
|
|
||||||
# Initialize the Gtk2 application object
|
|
||||||
@gtk2app = Msf::Ui::Gtk2::MyApp.new()
|
@splash = Msf::Ui::Gtk2::MySplash.new()
|
||||||
|
|
||||||
|
done_splash = false
|
||||||
|
|
||||||
|
Gtk.idle_add do
|
||||||
|
|
||||||
# Register event handlers
|
if(done_splash)
|
||||||
register_event_handlers
|
@gtk2app = Msf::Ui::Gtk2::MyApp.new()
|
||||||
end
|
@gtk2app.window.show
|
||||||
|
@splash.destroy
|
||||||
|
register_event_handlers
|
||||||
|
false
|
||||||
|
else
|
||||||
|
@splash.queue_draw
|
||||||
|
done_splash = true
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#
|
end
|
||||||
# Starts the main gtk2 loop
|
|
||||||
#
|
|
||||||
def run
|
|
||||||
ilog("msfgui has been started", LogSource)
|
|
||||||
Gtk.main
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the local directory that will hold the files to be serviced.
|
# Starts the main gtk2 loop
|
||||||
#
|
#
|
||||||
def resource_directory
|
def run
|
||||||
opts['ResourceDirectory'] || DefaultResourceDirectory
|
ilog("msfgui has been started", LogSource)
|
||||||
end
|
Gtk.main
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Saves configuration for MsfAssistant.
|
# Returns the local directory that will hold the files to be serviced.
|
||||||
#
|
#
|
||||||
def save_config
|
def resource_directory
|
||||||
# Build out the assistant config group
|
opts['ResourceDirectory'] || DefaultResourceDirectory
|
||||||
group = {}
|
end
|
||||||
|
|
||||||
if (active_module)
|
#
|
||||||
group['ActiveModule'] = active_module.fullname
|
# Saves configuration for MsfAssistant.
|
||||||
end
|
#
|
||||||
|
def save_config
|
||||||
|
# Build out the assistant config group
|
||||||
|
group = {}
|
||||||
|
|
||||||
# Save it
|
if (active_module)
|
||||||
begin
|
group['ActiveModule'] = active_module.fullname
|
||||||
Msf::Config.save(
|
end
|
||||||
ConfigGroup => group)
|
|
||||||
rescue
|
|
||||||
MsfDialog::Error.new(self, "Failed to save config file : #{$!}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
# Save it
|
||||||
# Returns a new Gdk::Pixbuf object
|
begin
|
||||||
#
|
Msf::Config.save(
|
||||||
def get_icon(name)
|
ConfigGroup => group)
|
||||||
Gdk::Pixbuf.new(File.join(resource_directory, 'pix', name))
|
rescue
|
||||||
end
|
MsfDialog::Error.new(self, "Failed to save config file : #{$!}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns only pics
|
# Returns a new Gdk::Pixbuf object
|
||||||
#
|
#
|
||||||
def get_image(name)
|
def get_icon(name)
|
||||||
return File.join(resource_directory, 'pix', name)
|
Gdk::Pixbuf.new(File.join(resource_directory, 'pix', name))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Returns only pics
|
||||||
|
#
|
||||||
|
def get_image(name)
|
||||||
|
return File.join(resource_directory, 'pix', name)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Adds text to the main logging screen
|
# Adds text to the main logging screen
|
||||||
#
|
#
|
||||||
def append_log_view(data)
|
def append_log_view(data)
|
||||||
|
|
||||||
data = Time.now.strftime("%H:%m:%S") + " " + data
|
data = Time.now.strftime("%H:%m:%S") + " " + data
|
||||||
|
|
||||||
return if not self.log_text
|
return if not self.log_text
|
||||||
|
|
||||||
view = self.log_text
|
view = self.log_text
|
||||||
buff = view.buffer
|
buff = view.buffer
|
||||||
|
|
||||||
if (not buff.get_mark('end_mark'))
|
if (not buff.get_mark('end_mark'))
|
||||||
buff.create_mark('end_mark', buff.end_iter, false)
|
buff.create_mark('end_mark', buff.end_iter, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
buff.insert(buff.end_iter, Rex::Text.to_utf8(data))
|
buff.insert(buff.end_iter, Rex::Text.to_utf8(data))
|
||||||
buff.move_mark('end_mark', buff.end_iter)
|
buff.move_mark('end_mark', buff.end_iter)
|
||||||
view.scroll_mark_onscreen(buff.get_mark('end_mark'))
|
view.scroll_mark_onscreen(buff.get_mark('end_mark'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The framework instance associated with this driver.
|
# The framework instance associated with this driver.
|
||||||
#
|
#
|
||||||
attr_reader :framework
|
attr_reader :framework
|
||||||
|
|
||||||
#
|
#
|
||||||
# The active module associated with the driver.
|
# The active module associated with the driver.
|
||||||
#
|
#
|
||||||
attr_accessor :active_module, :exploit
|
attr_accessor :active_module, :exploit
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
attr_writer :framework # :nodoc:
|
attr_writer :framework # :nodoc:
|
||||||
attr_accessor :opts # :nodoc:
|
attr_accessor :opts # :nodoc:
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initializes logging for the Gtk2 driver.
|
# Initializes logging for the Gtk2 driver.
|
||||||
#
|
#
|
||||||
def initialize_logging
|
def initialize_logging
|
||||||
level = (opts['LogLevel'] || 0).to_i
|
level = (opts['LogLevel'] || 0).to_i
|
||||||
|
|
||||||
Msf::Logging.enable_log_source(LogSource, level)
|
Msf::Logging.enable_log_source(LogSource, level)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Msf
|
||||||
obj.description.each_line do |line|
|
obj.description.each_line do |line|
|
||||||
desc << line.strip + "\n"
|
desc << line.strip + "\n"
|
||||||
end
|
end
|
||||||
@buffer.insert_with_tags(start, desc, 'black_italic_wrap')
|
@buffer.insert_with_tags(start, desc, 'black_wrap')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue