diff --git a/lib/msf/ui/gtk2/app.rb b/lib/msf/ui/gtk2/app.rb index 3a8757870e..4a5fa08dcf 100644 --- a/lib/msf/ui/gtk2/app.rb +++ b/lib/msf/ui/gtk2/app.rb @@ -181,6 +181,13 @@ module Ui # Update the StatusBar with all framework modules refresh() end + + # + # Actions for options stuff (databases, global variable, ...) + # + def on_options_activate + MsfPreferences::Main.new() + end # # Signal to refresh the treeview module diff --git a/lib/msf/ui/gtk2/driver.rb b/lib/msf/ui/gtk2/driver.rb index bf1bb518f5..3ecf48c529 100644 --- a/lib/msf/ui/gtk2/driver.rb +++ b/lib/msf/ui/gtk2/driver.rb @@ -10,6 +10,7 @@ require 'msf/ui/gtk2/frame' require 'msf/ui/gtk2/assistant' require 'msf/ui/gtk2/dialogs' require 'msf/ui/gtk2/window' +require 'msf/ui/gtk2/preferences' require 'msf/ui/gtk2/meterpreter' require 'msf/ui/gtk2/console' require 'msf/ui/gtk2/search' diff --git a/lib/msf/ui/gtk2/preferences.rb b/lib/msf/ui/gtk2/preferences.rb new file mode 100644 index 0000000000..73520249a6 --- /dev/null +++ b/lib/msf/ui/gtk2/preferences.rb @@ -0,0 +1,2 @@ +require 'msf/ui/gtk2/preferences/main.rb' +require 'msf/ui/gtk2/preferences/databases.rb' \ No newline at end of file diff --git a/lib/msf/ui/gtk2/preferences/databases.rb b/lib/msf/ui/gtk2/preferences/databases.rb new file mode 100644 index 0000000000..beda7c7348 --- /dev/null +++ b/lib/msf/ui/gtk2/preferences/databases.rb @@ -0,0 +1,61 @@ +module Msf + module Ui + module Gtk2 + + class MsfPreferences + + # + # This class is dedicated to perform database configuration + # + class Databases + + include Msf::Ui::Gtk2::MyControls + + def initialize + @page = Gtk::VBox.new + warning = Gtk::Label.new + warning.set_markup("Review your configuration before clicking the apply button") + @page.pack_start(warning, true, true, 0) + + bb = Gtk::HButtonBox.new() + test = Gtk::Button.new(Gtk::Stock::CONNECT) + modify = Gtk::Button.new(Gtk::Stock::EDIT) + rebuild = Gtk::Button.new(Gtk::Stock::EXECUTE) + + test.signal_connect('clicked') do + p "perform a test database connection" + end + + modify.signal_connect('clicked') do + p 'launch a wizard for database configuration' + end + + rebuild.signal_connect('clicked') do + p 'rebuild database' + end + + bb.pack_start(test, false, false) + bb.pack_start(modify, false, false) + bb.pack_start(rebuild, false, false) + + @page.pack_start(bb, false, false, 0) + end + + def page + return @page + end + + def label + return Gtk::Label.new("Databases") + end + + def type + end + + + end + + end + end + end +end diff --git a/lib/msf/ui/gtk2/preferences/main.rb b/lib/msf/ui/gtk2/preferences/main.rb new file mode 100644 index 0000000000..e190f4fe8a --- /dev/null +++ b/lib/msf/ui/gtk2/preferences/main.rb @@ -0,0 +1,64 @@ +module Msf + module Ui + module Gtk2 + + class MsfPreferences + + # + # This class is dedicated to the options stuff + # + class Main < Gtk::Dialog + + include Msf::Ui::Gtk2::MyControls + + def initialize + # Array for the face buttons + buttons = [ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK ], [ Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE ] + + # call the parent + super("", $gtk2driver.main, Gtk::Dialog::DESTROY_WITH_PARENT, *buttons) + self.default_response = Gtk::Dialog::RESPONSE_OK + + # Define the size and border + set_default_size(400, 400) + # set_border_width(10) + + # Notebook + @notebook = Gtk::Notebook.new() + + # Databases page + database = MsfPreferences::Databases.new() + + # append database page + @notebook.append_page(database.page, database.label) + + # append another pages here ;-) + # + + @notebook.tab_pos = Gtk::POS_TOP + vbox.add(@notebook) + @notebook.border_width = 10 + + @notebook.realize + + signal_connect('response') do |dialog, response_id| + if response_id == Gtk::Dialog::RESPONSE_OK + begin + # collect() + rescue ::Exception => e + MsfDialog::Error.new(self, e) + end + end + end + + show_all and run + destroy + end + + end + + end + + end + end +end