add parameters stuff (menu, widget, ...)

git-svn-id: file:///home/svn/framework3/trunk@4557 4d416f70-5f16-0410-b530-b9f4589650da
unstable
fab 2007-03-24 22:56:59 +00:00
parent a1d3f0e4f7
commit 4d7ddb0e07
4 changed files with 70 additions and 15 deletions

View File

@ -72,13 +72,13 @@
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="options"> <widget class="GtkMenuItem" id="parameters">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Options</property> <property name="label" translatable="yes">Parameters</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child> <child>
<widget class="GtkMenu" id="options_menu"> <widget class="GtkMenu" id="parameters_menu">
<child> <child>
<widget class="GtkImageMenuItem" id="preferences"> <widget class="GtkImageMenuItem" id="preferences">
@ -90,11 +90,23 @@
</child> </child>
<child> <child>
<widget class="GtkMenuItem" id="payload"> <widget class="GtkImageMenuItem" id="databases">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Payload</property> <property name="label" translatable="yes">Databases</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<signal name="activate" handler="on_payload_activate"/> <signal name="activate" handler="on_databases_activate" last_modification_time="Sat, 24 Mar 2007 22:11:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-network</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>

View File

@ -106,12 +106,18 @@ class MyApp < MyGlade
Gtk.main_quit Gtk.main_quit
end end
#
# Action for "Parameters/Preferences"
#
def on_preferences_activate def on_preferences_activate
MsfOptions::Preferences.new() MsfParameters::Preferences.new()
end end
def on_payload_activate #
puts "TODO: Set preferences for the payload choice" # Action for "Parameters"/"Databases" menu
#
def on_databases_activate
MsfParameters::Databases.new()
end end
# #

View File

@ -11,7 +11,7 @@ require 'msf/ui/gtk2/dialogs'
require 'msf/ui/gtk2/console' require 'msf/ui/gtk2/console'
require 'msf/ui/gtk2/view' require 'msf/ui/gtk2/view'
require 'msf/ui/gtk2/search' require 'msf/ui/gtk2/search'
require 'msf/ui/gtk2/options' require 'msf/ui/gtk2/parameters'
require 'msf/ui/gtk2/framework_event_manager' require 'msf/ui/gtk2/framework_event_manager'

View File

@ -17,25 +17,33 @@ class SkeletonOption < Gtk::Dialog
self.resizable = true self.resizable = true
self.has_separator = true self.has_separator = true
self.vbox.spacing = 12 self.vbox.spacing = 12
self.vbox.set_homogeneous(false)
self.title = title self.title = title
self.set_default_size(500, 400)
model = create_model(items) model = create_model(items)
treeview = Gtk::TreeView.new(model) treeview = Gtk::TreeView.new(model)
treeview.set_size_request(5, 200)
hbox = Gtk::HBox.new(false, 10) @hbox = Gtk::HBox.new(false, 10)
# ScrolledWindow # ScrolledWindow
sw = Gtk::ScrolledWindow.new sw = Gtk::ScrolledWindow.new
sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC) sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
hbox.pack_start(sw) @hbox.pack_start(sw)
sw.add(treeview) sw.add(treeview)
renderer = Gtk::CellRendererText.new renderer = Gtk::CellRendererText.new
column = Gtk::TreeViewColumn.new('Select an item', renderer, 'text' => 0) column = Gtk::TreeViewColumn.new('Select an item', renderer, 'text' => 0)
#column.fixed_width = 20
column.pack_start(renderer, false) column.pack_start(renderer, false)
treeview.append_column(column) treeview.append_column(column)
self.vbox.pack_start(hbox) self.vbox.pack_start(@hbox, false, false, 0)
@label = Gtk::Label.new("test")
@frame = Gtk::Frame.new("frame")
@frame.set_size_request(300, 400)
@hbox.pack_end(@frame, true, true, 0)
# Signal # Signal
selection = treeview.selection selection = treeview.selection
@ -58,11 +66,14 @@ class SkeletonOption < Gtk::Dialog
def selection_changed(selection) def selection_changed(selection)
iter = selection.selected iter = selection.selected
puts iter[0] @frame.set_label(iter[0])
end end
end end
class MsfOptions class MsfParameters
##
# Display the preference parameters
##
class Preferences < Msf::Ui::Gtk2::SkeletonOption class Preferences < Msf::Ui::Gtk2::SkeletonOption
def initialize def initialize
menu = ["Exploits", "Payloads"] menu = ["Exploits", "Payloads"]
@ -84,6 +95,32 @@ class MsfOptions
def w_payloads def w_payloads
end end
end end
##
# Display the databases parameters
##
class Databases < Msf::Ui::Gtk2::SkeletonOption
def initialize
menu = ["AutoPOWN", "OPCODES"]
super("Databases", menu)
show_all and run
destroy
end
#
# Describe the autopown widget
#
def w_autopown
end
#
# Describe the opcode widget opcodes
#
def w_opcode
end
end
end end
end end