began the database configuration ;-)

git-svn-id: file:///home/svn/framework3/trunk@5260 4d416f70-5f16-0410-b530-b9f4589650da
unstable
fab 2007-12-31 17:03:06 +00:00
parent b2d21ef28f
commit 76fd0864fb
5 changed files with 135 additions and 0 deletions

View File

@ -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

View File

@ -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'

View File

@ -0,0 +1,2 @@
require 'msf/ui/gtk2/preferences/main.rb'
require 'msf/ui/gtk2/preferences/databases.rb'

View File

@ -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 <b>apply</b> 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

View File

@ -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 ;-)
# <!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