Fixes #180. Places all exploit and auxiliary options into a nice scrolling window. Solves a crash when validation fails in the wizard
git-svn-id: file:///home/svn/framework3/trunk@5360 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
e17f43b9d5
commit
c66f8706ef
|
@ -46,19 +46,15 @@ module Msf
|
|||
@hash = {}
|
||||
|
||||
# Call the parent
|
||||
super(@active_module.refname)
|
||||
super(@active_module.name)
|
||||
|
||||
# Initialize exploit driver's exploit instance
|
||||
@mydriver = $gtk2driver
|
||||
@mydriver.exploit = framework.auxiliary.create(@active_module.refname)
|
||||
@mydriver.active_module = @active_module
|
||||
|
||||
# Main interface
|
||||
@frame_advanced = Gtk::Expander.new("Advanced")
|
||||
@frame_evasion = Gtk::Expander.new("Evasion")
|
||||
@options_required = Gtk::VBox.new(false, 0)
|
||||
@options_advanced = Gtk::VBox.new(false, 0)
|
||||
@options_evasion = Gtk::VBox.new(false, 0)
|
||||
initialize_options()
|
||||
|
||||
|
||||
# Begin the wizard
|
||||
options_completion()
|
||||
|
@ -93,6 +89,11 @@ module Msf
|
|||
# Save the framework's datastore
|
||||
framework.save_config
|
||||
@mydriver.exploit.datastore.to_file(Msf::Config.config_file, @mydriver.exploit.refname)
|
||||
MsfDialog::Information.new(self,
|
||||
"Configuration Saved",
|
||||
"Settings for auxiliary module #{@mydriver.exploit.refname} have been saved to #{Msf::Config.config_file}. " +
|
||||
"These settings will be loaded the next time this module is accessed."
|
||||
)
|
||||
|
||||
$gtk2driver.append_log_view("Saved configuration to: #{Msf::Config.config_file}\n")
|
||||
end
|
||||
|
@ -109,6 +110,7 @@ module Msf
|
|||
[@label_review] # next
|
||||
)
|
||||
display()
|
||||
initialize_options()
|
||||
options_completion()
|
||||
else
|
||||
self.page = "end"
|
||||
|
@ -117,6 +119,7 @@ module Msf
|
|||
nil
|
||||
)
|
||||
display()
|
||||
initialize_options()
|
||||
review_completion()
|
||||
end
|
||||
end
|
||||
|
@ -137,45 +140,46 @@ module Msf
|
|||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Instantiate the options page controls
|
||||
#
|
||||
def initialize_options
|
||||
@frame_standard = Gtk::Expander.new("Standard")
|
||||
@frame_advanced = Gtk::Expander.new("Advanced")
|
||||
@frame_evasion = Gtk::Expander.new("Evasion")
|
||||
@options_standard = Gtk::VBox.new(false, 0)
|
||||
@options_advanced = Gtk::VBox.new(false, 0)
|
||||
@options_evasion = Gtk::VBox.new(false, 0)
|
||||
|
||||
@framer = Gtk::VBox.new(false, 10)
|
||||
@scroller = Gtk::ScrolledWindow.new
|
||||
@scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
@scroller.set_size_request(580, 420)
|
||||
|
||||
@viewport = Gtk::Viewport.new(@scroller.hadjustment, @scroller.vadjustment)
|
||||
|
||||
@frame_standard.expanded = true
|
||||
end
|
||||
|
||||
#
|
||||
# Display options view
|
||||
#
|
||||
def options_completion
|
||||
self.page = "options"
|
||||
|
||||
# Expanded frame
|
||||
@frame_advanced.each do |widget|
|
||||
@frame_advanced.remove(widget)
|
||||
end
|
||||
@frame_evasion.each do |widget|
|
||||
@frame_evasion.remove(widget)
|
||||
end
|
||||
# Title and three sets of options
|
||||
title = Gtk::Label.new
|
||||
title.set_markup("<big><b>#{@mydriver.exploit.name}</b></big>")
|
||||
@framer.pack_start(title, false, true, 5)
|
||||
@framer.pack_start(@frame_standard, false, false, 10)
|
||||
@framer.pack_start(@frame_advanced, false, false, 10)
|
||||
@framer.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
# Required
|
||||
@options_required.each do |widget|
|
||||
@options_required.remove(widget)
|
||||
end
|
||||
|
||||
# Advanced
|
||||
@options_advanced.each do |widget|
|
||||
@options_advanced.remove(widget)
|
||||
end
|
||||
|
||||
# Evasion
|
||||
@options_evasion.each do |widget|
|
||||
@options_evasion.remove(widget)
|
||||
end
|
||||
|
||||
# Pack
|
||||
self.main.pack_start(@options_required, false, false, 10)
|
||||
self.main.pack_start(@frame_advanced, false, false, 10)
|
||||
self.main.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
# Standards options
|
||||
# Standard options
|
||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||
next if (opt.evasion?)
|
||||
next if (opt.advanced?)
|
||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
@options_standard.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
end
|
||||
|
||||
# Advanced options
|
||||
|
@ -191,11 +195,40 @@ module Msf
|
|||
end
|
||||
|
||||
# Display
|
||||
@frame_advanced.set_label("Advanced")
|
||||
@frame_advanced.add(@options_advanced)
|
||||
@frame_evasion.set_label("Evasion")
|
||||
@frame_evasion.add(@options_evasion)
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_standard, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_standard.add(indent)
|
||||
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_advanced, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_advanced.add(indent)
|
||||
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_evasion, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_evasion.add(indent)
|
||||
|
||||
labels = ["Standard", "Advanced", "Evasion"]
|
||||
[@frame_standard, @frame_advanced, @frame_evasion].each do |obj|
|
||||
txt = labels.shift
|
||||
obj.spacing = 10
|
||||
obj.use_markup = true
|
||||
obj.label = "<big><b>#{txt}</b></big>"
|
||||
end
|
||||
|
||||
# Stuff it into a viewport
|
||||
@viewport.add(@framer)
|
||||
|
||||
# Stuff the viewport into a scrolledwindow
|
||||
@scroller.add(@viewport)
|
||||
|
||||
# Stuff this into main and call it done
|
||||
self.main.pack_start(@scroller, true, true, 10)
|
||||
self.main.show_all
|
||||
end
|
||||
|
||||
|
@ -203,7 +236,7 @@ module Msf
|
|||
# Put all values in a hash
|
||||
#
|
||||
def dump_to_hash
|
||||
@options_required.each do |widget|
|
||||
@options_standard.each do |widget|
|
||||
name, value = widget.get_pair
|
||||
begin
|
||||
if (@mydriver.exploit.options[name].default.to_s == value)
|
||||
|
|
|
@ -56,7 +56,7 @@ module Msf
|
|||
@hash = {}
|
||||
|
||||
# Call the parent
|
||||
super(@active_module.refname)
|
||||
super(@active_module.name)
|
||||
|
||||
# Initialize exploit driver's exploit instance
|
||||
@mydriver = Msf::ExploitDriver.new(framework)
|
||||
|
@ -65,12 +65,7 @@ module Msf
|
|||
# Populate the datastore if possible
|
||||
@mydriver.exploit.load_config
|
||||
|
||||
# Main interface
|
||||
@frame_advanced = Gtk::Expander.new("Advanced")
|
||||
@frame_evasion = Gtk::Expander.new("Evasion")
|
||||
@options_required = Gtk::VBox.new(false, 0)
|
||||
@options_advanced = Gtk::VBox.new(false, 0)
|
||||
@options_evasion = Gtk::VBox.new(false, 0)
|
||||
initialize_options()
|
||||
|
||||
# Begin the wizard
|
||||
target_completion()
|
||||
|
@ -141,6 +136,7 @@ module Msf
|
|||
[@label_review] # next
|
||||
)
|
||||
display()
|
||||
initialize_options()
|
||||
options_completion()
|
||||
elsif (self.page == "options")
|
||||
if not validate()
|
||||
|
@ -150,6 +146,7 @@ module Msf
|
|||
[@label_review] # next
|
||||
)
|
||||
display()
|
||||
initialize_options()
|
||||
options_completion()
|
||||
else
|
||||
self.page = "end"
|
||||
|
@ -190,6 +187,7 @@ module Msf
|
|||
[@label_review]
|
||||
)
|
||||
display()
|
||||
initialize_options()
|
||||
options_completion()
|
||||
end
|
||||
end
|
||||
|
@ -301,77 +299,47 @@ module Msf
|
|||
self.main.show_all
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Instantiate the options page controls
|
||||
#
|
||||
def initialize_options
|
||||
@frame_standard = Gtk::Expander.new("Standard")
|
||||
@frame_advanced = Gtk::Expander.new("Advanced")
|
||||
@frame_evasion = Gtk::Expander.new("Evasion")
|
||||
@options_standard = Gtk::VBox.new(false, 0)
|
||||
@options_advanced = Gtk::VBox.new(false, 0)
|
||||
@options_evasion = Gtk::VBox.new(false, 0)
|
||||
|
||||
@framer = Gtk::VBox.new(false, 10)
|
||||
@scroller = Gtk::ScrolledWindow.new
|
||||
@scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
@scroller.set_size_request(580, 420)
|
||||
|
||||
@viewport = Gtk::Viewport.new(@scroller.hadjustment, @scroller.vadjustment)
|
||||
|
||||
@frame_standard.expanded = true
|
||||
end
|
||||
|
||||
#
|
||||
# Display options view
|
||||
#
|
||||
def options_completion
|
||||
self.page = "options"
|
||||
|
||||
# Expanded frame
|
||||
@frame_advanced.each do |widget|
|
||||
@frame_advanced.remove(widget)
|
||||
end
|
||||
@frame_evasion.each do |widget|
|
||||
@frame_evasion.remove(widget)
|
||||
end
|
||||
# Title and three sets of options
|
||||
title = Gtk::Label.new
|
||||
title.set_markup("<big><b>#{@mydriver.exploit.name}</b></big>")
|
||||
@framer.pack_start(title, false, true, 5)
|
||||
@framer.pack_start(@frame_standard, false, false, 10)
|
||||
@framer.pack_start(@frame_advanced, false, false, 10)
|
||||
@framer.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
# Required
|
||||
@options_required.each do |widget|
|
||||
@options_required.remove(widget)
|
||||
end
|
||||
|
||||
# Advanced
|
||||
@options_advanced.each do |widget|
|
||||
@options_advanced.remove(widget)
|
||||
end
|
||||
|
||||
# Evasion
|
||||
@options_evasion.each do |widget|
|
||||
@options_evasion.remove(widget)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# Pack
|
||||
self.main.pack_start(@options_required, false, false, 10)
|
||||
|
||||
# TODO
|
||||
#self.main.pack_start(@frame_advanced, false, false, 10)
|
||||
#self.main.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
#scrl = Gtk::ScrolledWindow.new
|
||||
#scrl.shadow_type = Gtk::SHADOW_NONE
|
||||
#scrl.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||
|
||||
#vscr = Gtk::VBox.new
|
||||
|
||||
#vscr.pack_start(@options_required, false, false, 10)
|
||||
#vscr.pack_start(@frame_advanced, false, false, 10)
|
||||
#vscr.pack_start(@frame_evasion, false, false, 10)
|
||||
|
||||
#scrl.add_with_viewport(vscr)
|
||||
|
||||
#self.main.pack_start(scrl, false, false, 20)
|
||||
|
||||
# Payload options
|
||||
@mydriver.payload = framework.payloads.create(@hash["PAYLOAD"])
|
||||
|
||||
# Pack all options
|
||||
@mydriver.payload.options.each do |key, opt|
|
||||
next if (opt.advanced?)
|
||||
next if (opt.evasion?)
|
||||
if (opt.required?)
|
||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
else
|
||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
end
|
||||
end
|
||||
|
||||
# Standards options
|
||||
# Standard options
|
||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||
next if (opt.evasion?)
|
||||
next if (opt.advanced?)
|
||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
@options_standard.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
end
|
||||
|
||||
# Advanced options
|
||||
|
@ -386,20 +354,62 @@ module Msf
|
|||
@options_evasion.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
end
|
||||
|
||||
# TODO: Display temporaly desactived
|
||||
#@frame_advanced.set_label("Advanced")
|
||||
#@frame_advanced.add(@options_advanced)
|
||||
#@frame_evasion.set_label("Evasion")
|
||||
#@frame_evasion.add(@options_evasion)
|
||||
# Payload options
|
||||
@mydriver.payload = framework.payloads.create(@hash["PAYLOAD"])
|
||||
@mydriver.payload.options.each do |key, opt|
|
||||
next if (opt.advanced?)
|
||||
next if (opt.evasion?)
|
||||
if (opt.required?)
|
||||
@options_standard.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
else
|
||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||
end
|
||||
end
|
||||
|
||||
# Display
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_standard, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_standard.add(indent)
|
||||
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_advanced, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_advanced.add(indent)
|
||||
|
||||
indent = Gtk::HBox.new(false, 5)
|
||||
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||
indent.pack_start(@options_evasion, false, false, 0)
|
||||
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||
@frame_evasion.add(indent)
|
||||
|
||||
labels = ["Standard", "Advanced", "Evasion"]
|
||||
[@frame_standard, @frame_advanced, @frame_evasion].each do |obj|
|
||||
txt = labels.shift
|
||||
obj.spacing = 10
|
||||
obj.use_markup = true
|
||||
obj.label = "<big><b>#{txt}</b></big>"
|
||||
end
|
||||
|
||||
# Stuff it into a viewport
|
||||
@viewport.add(@framer)
|
||||
|
||||
# Stuff the viewport into a scrolledwindow
|
||||
@scroller.add(@viewport)
|
||||
|
||||
# Stuff this into main and call it done
|
||||
self.main.pack_start(@scroller, true, true, 10)
|
||||
self.main.show_all
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Put all values in a hash
|
||||
#
|
||||
def dump_to_hash
|
||||
@options_required.each do |widget|
|
||||
@options_standard.each do |widget|
|
||||
name, value = widget.get_pair
|
||||
begin
|
||||
@hash[name] = value
|
||||
|
|
|
@ -253,27 +253,24 @@ module Msf
|
|||
#
|
||||
def create_banner
|
||||
|
||||
#
|
||||
# Not use for this moment ...
|
||||
#
|
||||
# da = Gtk::DrawingArea.new
|
||||
# da.set_size_request(600, 60)
|
||||
#
|
||||
# # Signal
|
||||
# da.signal_connect('expose-event') do |widget, event|
|
||||
# cr = widget.window.create_cairo_context
|
||||
# cr.scale(*widget.window.size)
|
||||
# cr.set_line_width(0.04)
|
||||
#
|
||||
# cr.new_path
|
||||
# image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png"))
|
||||
# cr.scale(1.0 / image.width, 1.0 / image.height)
|
||||
# cr.set_source(image, 0, 0)
|
||||
#
|
||||
# cr.paint
|
||||
# end
|
||||
da = Gtk::DrawingArea.new
|
||||
da.set_size_request(600, 60)
|
||||
|
||||
da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
|
||||
Signal
|
||||
da.signal_connect('expose-event') do |widget, event|
|
||||
cr = widget.window.create_cairo_context
|
||||
cr.scale(*widget.window.size)
|
||||
cr.set_line_width(0.04)
|
||||
|
||||
cr.new_path
|
||||
image = Cairo::ImageSurface.from_png(driver.get_image("banner_assistant.png"))
|
||||
cr.scale(1.0 / image.width, 1.0 / image.height)
|
||||
cr.set_source(image, 0, 0)
|
||||
|
||||
cr.paint
|
||||
end
|
||||
|
||||
# da = Gtk::Image.new(driver.get_image("banner_assistant.png"))
|
||||
|
||||
return da
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue