2007-03-19 23:15:49 +00:00
|
|
|
module Msf
|
|
|
|
module Ui
|
|
|
|
module Gtk2
|
|
|
|
|
|
|
|
##
|
2007-03-25 21:44:48 +00:00
|
|
|
# Skeleton class for all parameters stuff
|
2007-03-19 23:15:49 +00:00
|
|
|
# title = Options title (menu)
|
2007-03-25 21:44:48 +00:00
|
|
|
# items = Array
|
2007-03-19 23:15:49 +00:00
|
|
|
##
|
|
|
|
class SkeletonOption < Gtk::Dialog
|
2007-03-25 21:44:48 +00:00
|
|
|
|
|
|
|
attr_accessor :frame
|
|
|
|
|
2007-03-21 22:32:36 +00:00
|
|
|
def initialize(title, items)
|
2007-03-19 23:15:49 +00:00
|
|
|
super("", $gtk2driver.main, Gtk::Dialog::DESTROY_WITH_PARENT,
|
|
|
|
[ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE ],
|
|
|
|
[ Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE ])
|
|
|
|
|
|
|
|
self.border_width = 6
|
|
|
|
self.resizable = true
|
|
|
|
self.has_separator = true
|
|
|
|
self.vbox.spacing = 12
|
2007-03-24 22:56:59 +00:00
|
|
|
self.vbox.set_homogeneous(false)
|
2007-03-19 23:15:49 +00:00
|
|
|
self.title = title
|
2007-03-24 22:56:59 +00:00
|
|
|
self.set_default_size(500, 400)
|
2007-03-19 23:15:49 +00:00
|
|
|
|
2007-03-21 22:32:36 +00:00
|
|
|
model = create_model(items)
|
|
|
|
treeview = Gtk::TreeView.new(model)
|
2007-03-24 22:56:59 +00:00
|
|
|
treeview.set_size_request(5, 200)
|
2007-03-21 22:32:36 +00:00
|
|
|
|
2007-03-24 22:56:59 +00:00
|
|
|
@hbox = Gtk::HBox.new(false, 10)
|
2007-03-21 22:32:36 +00:00
|
|
|
|
|
|
|
# ScrolledWindow
|
|
|
|
sw = Gtk::ScrolledWindow.new
|
|
|
|
sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
|
2007-03-24 22:56:59 +00:00
|
|
|
@hbox.pack_start(sw)
|
2007-03-21 22:32:36 +00:00
|
|
|
sw.add(treeview)
|
|
|
|
|
|
|
|
renderer = Gtk::CellRendererText.new
|
|
|
|
column = Gtk::TreeViewColumn.new('Select an item', renderer, 'text' => 0)
|
2007-03-24 22:56:59 +00:00
|
|
|
#column.fixed_width = 20
|
2007-03-21 22:32:36 +00:00
|
|
|
column.pack_start(renderer, false)
|
|
|
|
treeview.append_column(column)
|
|
|
|
|
2007-03-24 22:56:59 +00:00
|
|
|
self.vbox.pack_start(@hbox, false, false, 0)
|
2007-03-25 21:44:48 +00:00
|
|
|
@frame = Gtk::Frame.new
|
2007-03-24 22:56:59 +00:00
|
|
|
@frame.set_size_request(300, 400)
|
|
|
|
@hbox.pack_end(@frame, true, true, 0)
|
2007-03-21 22:32:36 +00:00
|
|
|
|
|
|
|
# Signal
|
|
|
|
selection = treeview.selection
|
|
|
|
selection.mode = Gtk::SELECTION_SINGLE
|
|
|
|
selection.signal_connect('changed') do |s|
|
|
|
|
selection_changed(s)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-03-25 21:44:48 +00:00
|
|
|
#
|
|
|
|
# Create and return the model
|
|
|
|
#
|
2007-03-21 22:32:36 +00:00
|
|
|
def create_model(items)
|
|
|
|
store = Gtk::ListStore.new(String)
|
|
|
|
|
|
|
|
items.each do |item|
|
|
|
|
iter = store.append
|
|
|
|
iter[0] = item
|
|
|
|
end
|
|
|
|
|
|
|
|
return store
|
|
|
|
end
|
|
|
|
|
2007-03-25 21:44:48 +00:00
|
|
|
#
|
|
|
|
# Destroy all children widgets in the frame
|
|
|
|
#
|
|
|
|
def clean_frame
|
|
|
|
@frame.each do |w|
|
|
|
|
w.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dummy
|
|
|
|
#
|
2007-03-21 22:32:36 +00:00
|
|
|
def selection_changed(selection)
|
2007-03-25 21:44:48 +00:00
|
|
|
#
|
|
|
|
# must be present in the real class
|
|
|
|
#
|
2007-03-19 23:15:49 +00:00
|
|
|
end
|
2007-04-05 22:46:58 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Return a dialog file chooser
|
|
|
|
#
|
|
|
|
def file_chooser(title=nil)
|
|
|
|
dialog = Gtk::FileChooserDialog.new(title,
|
|
|
|
nil,
|
|
|
|
Gtk::FileChooser::ACTION_OPEN,
|
|
|
|
nil,
|
|
|
|
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT],
|
|
|
|
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL]
|
|
|
|
)
|
|
|
|
end
|
2007-03-19 23:15:49 +00:00
|
|
|
end
|
|
|
|
|
2007-03-24 22:56:59 +00:00
|
|
|
class MsfParameters
|
|
|
|
##
|
|
|
|
# Display the preference parameters
|
|
|
|
##
|
2007-03-19 23:15:49 +00:00
|
|
|
class Preferences < Msf::Ui::Gtk2::SkeletonOption
|
2007-03-21 22:32:36 +00:00
|
|
|
def initialize
|
|
|
|
menu = ["Exploits", "Payloads"]
|
|
|
|
super("Preferences", menu)
|
2007-03-19 23:15:49 +00:00
|
|
|
|
2007-03-25 21:44:48 +00:00
|
|
|
w_exploits
|
|
|
|
|
2007-03-19 23:15:49 +00:00
|
|
|
show_all and run
|
|
|
|
destroy
|
|
|
|
end
|
2007-03-21 22:32:36 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Describe the exploits widget
|
|
|
|
#
|
|
|
|
def w_exploits
|
2007-03-25 21:44:48 +00:00
|
|
|
frame.set_label("Exploits")
|
|
|
|
frame.add(Gtk::Label.new("Add specifics widgets here"))
|
|
|
|
frame.show_all
|
2007-03-21 22:32:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Describe the payloads widget
|
|
|
|
#
|
|
|
|
def w_payloads
|
2007-03-25 21:44:48 +00:00
|
|
|
frame.set_label("Payloads")
|
2007-04-05 22:46:58 +00:00
|
|
|
frame.shadow_type = Gtk::SHADOW_IN
|
2007-03-25 21:44:48 +00:00
|
|
|
#frame.add(Gtk::Label.new("Add specifics widgets here"))
|
|
|
|
|
|
|
|
#
|
|
|
|
# add specific widget here
|
|
|
|
#
|
|
|
|
vbox_frame = Gtk::VBox.new(false, 0)
|
|
|
|
|
2007-04-05 22:46:58 +00:00
|
|
|
# VNC
|
2007-03-25 21:44:48 +00:00
|
|
|
frame.add(vbox_frame)
|
|
|
|
|
2007-04-05 22:46:58 +00:00
|
|
|
table_vnc = Gtk::Table.new(2, 2, false)
|
|
|
|
table_vnc.set_row_spacings(4)
|
|
|
|
table_vnc.set_column_spacings(4)
|
|
|
|
vbox_frame.pack_start(table_vnc, false, false, 5)
|
|
|
|
|
2007-03-25 21:44:48 +00:00
|
|
|
label_vnc = Gtk::Label.new("Viewer VNC path: ")
|
2007-04-05 22:46:58 +00:00
|
|
|
table_vnc.attach_defaults(label_vnc, 0, 1, 0, 1)
|
|
|
|
|
|
|
|
hbox_vnc = Gtk::HBox.new(false, 5)
|
2007-03-25 21:44:48 +00:00
|
|
|
entry_vnc = Gtk::Entry.new
|
2007-04-05 22:46:58 +00:00
|
|
|
table_vnc.attach_defaults(entry_vnc, 0, 2, 1, 2)
|
2007-03-25 21:44:48 +00:00
|
|
|
|
|
|
|
button_vnc = Gtk::HButtonBox.new
|
|
|
|
button_vnc.layout_style = Gtk::ButtonBox::END
|
2007-04-05 22:46:58 +00:00
|
|
|
button = Gtk::Button.new(Gtk::Stock::OPEN)
|
|
|
|
button_vnc.add(button)
|
|
|
|
#button_vnc = Gtk::FileChooserButton.new("Select a file", Gtk::FileChooser::ACTION_OPEN)
|
|
|
|
table_vnc.attach_defaults(button_vnc, 1, 2, 0, 1)
|
|
|
|
button.signal_connect('clicked') do
|
|
|
|
dialog = file_chooser("Select your VNC viewer")
|
|
|
|
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
|
|
|
entry_vnc.set_text(dialog.uri)
|
|
|
|
end
|
|
|
|
dialog.destroy
|
|
|
|
end
|
2007-03-25 21:44:48 +00:00
|
|
|
|
|
|
|
frame.show_all
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Signals
|
|
|
|
#
|
|
|
|
def selection_changed(selection)
|
|
|
|
iter = selection.selected
|
|
|
|
case iter[0]
|
|
|
|
when "Exploits"
|
|
|
|
clean_frame and w_exploits
|
|
|
|
when "Payloads"
|
|
|
|
clean_frame and w_payloads
|
|
|
|
end
|
2007-03-21 22:32:36 +00:00
|
|
|
end
|
2007-03-19 23:15:49 +00:00
|
|
|
end
|
2007-03-24 22:56:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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
|
2007-03-25 21:44:48 +00:00
|
|
|
frame.set_label("AutoPWN")
|
2007-03-24 22:56:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Describe the opcode widget opcodes
|
|
|
|
#
|
|
|
|
def w_opcode
|
2007-03-25 21:44:48 +00:00
|
|
|
frame.set_label("OPCODES")
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Signals
|
|
|
|
#
|
|
|
|
def selection_changed(selection)
|
|
|
|
iter = selection.selected
|
|
|
|
case iter[0]
|
|
|
|
when "AutoPOWN"
|
|
|
|
clean_frame and w_autopown
|
|
|
|
when "OPCODES"
|
|
|
|
clean_frame and w_opcode
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
###
|
|
|
|
# Display the options parameters
|
|
|
|
###
|
|
|
|
class Options < Msf::Ui::Gtk2::SkeletonOption
|
|
|
|
def initialize
|
|
|
|
menu = ["Debug", "Tips", "Proxy", "Update"]
|
|
|
|
super("Options", menu)
|
|
|
|
|
|
|
|
show_all and run
|
|
|
|
destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
def w_debug
|
|
|
|
frame.set_label("Debug")
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Want to show tips ... or not !
|
|
|
|
#
|
|
|
|
def w_tips
|
|
|
|
frame.set_label("Tips")
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Need a proxy ?
|
|
|
|
#
|
|
|
|
def w_proxy
|
|
|
|
frame.set_label("Proxy")
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Update stuff
|
|
|
|
#
|
|
|
|
def w_update
|
|
|
|
frame.set_label("Update")
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Signals
|
|
|
|
#
|
|
|
|
def selection_changed(selection)
|
|
|
|
iter = selection.selected
|
|
|
|
case iter[0]
|
|
|
|
when "Debug"
|
|
|
|
clean_frame and w_debug
|
|
|
|
when "Tips"
|
|
|
|
clean_frame and w_tips
|
|
|
|
when "Proxy"
|
|
|
|
clean_frame and w_proxy
|
|
|
|
when "Update"
|
|
|
|
clean_frame and w_update
|
|
|
|
end
|
2007-03-24 22:56:59 +00:00
|
|
|
end
|
|
|
|
end
|
2007-03-19 23:15:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|