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,20 +46,16 @@ module Msf
|
||||||
@hash = {}
|
@hash = {}
|
||||||
|
|
||||||
# Call the parent
|
# Call the parent
|
||||||
super(@active_module.refname)
|
super(@active_module.name)
|
||||||
|
|
||||||
# Initialize exploit driver's exploit instance
|
# Initialize exploit driver's exploit instance
|
||||||
@mydriver = $gtk2driver
|
@mydriver = $gtk2driver
|
||||||
@mydriver.exploit = framework.auxiliary.create(@active_module.refname)
|
@mydriver.exploit = framework.auxiliary.create(@active_module.refname)
|
||||||
@mydriver.active_module = @active_module
|
@mydriver.active_module = @active_module
|
||||||
|
|
||||||
# Main interface
|
initialize_options()
|
||||||
@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)
|
|
||||||
|
|
||||||
|
|
||||||
# Begin the wizard
|
# Begin the wizard
|
||||||
options_completion()
|
options_completion()
|
||||||
|
|
||||||
|
@ -93,7 +89,12 @@ module Msf
|
||||||
# Save the framework's datastore
|
# Save the framework's datastore
|
||||||
framework.save_config
|
framework.save_config
|
||||||
@mydriver.exploit.datastore.to_file(Msf::Config.config_file, @mydriver.exploit.refname)
|
@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")
|
$gtk2driver.append_log_view("Saved configuration to: #{Msf::Config.config_file}\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,6 +110,7 @@ module Msf
|
||||||
[@label_review] # next
|
[@label_review] # next
|
||||||
)
|
)
|
||||||
display()
|
display()
|
||||||
|
initialize_options()
|
||||||
options_completion()
|
options_completion()
|
||||||
else
|
else
|
||||||
self.page = "end"
|
self.page = "end"
|
||||||
|
@ -117,6 +119,7 @@ module Msf
|
||||||
nil
|
nil
|
||||||
)
|
)
|
||||||
display()
|
display()
|
||||||
|
initialize_options()
|
||||||
review_completion()
|
review_completion()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -137,73 +140,103 @@ module Msf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display options view
|
# Instantiate the options page controls
|
||||||
#
|
#
|
||||||
def options_completion
|
def initialize_options
|
||||||
self.page = "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)
|
||||||
|
|
||||||
# Expanded frame
|
@framer = Gtk::VBox.new(false, 10)
|
||||||
@frame_advanced.each do |widget|
|
@scroller = Gtk::ScrolledWindow.new
|
||||||
@frame_advanced.remove(widget)
|
@scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
end
|
@scroller.set_size_request(580, 420)
|
||||||
@frame_evasion.each do |widget|
|
|
||||||
@frame_evasion.remove(widget)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Required
|
@viewport = Gtk::Viewport.new(@scroller.hadjustment, @scroller.vadjustment)
|
||||||
@options_required.each do |widget|
|
|
||||||
@options_required.remove(widget)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Advanced
|
@frame_standard.expanded = true
|
||||||
@options_advanced.each do |widget|
|
end
|
||||||
@options_advanced.remove(widget)
|
|
||||||
end
|
#
|
||||||
|
# Display options view
|
||||||
|
#
|
||||||
|
def options_completion
|
||||||
|
self.page = "options"
|
||||||
|
|
||||||
# Evasion
|
# Title and three sets of options
|
||||||
@options_evasion.each do |widget|
|
title = Gtk::Label.new
|
||||||
@options_evasion.remove(widget)
|
title.set_markup("<big><b>#{@mydriver.exploit.name}</b></big>")
|
||||||
end
|
@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)
|
||||||
|
|
||||||
# Pack
|
# Standard options
|
||||||
self.main.pack_start(@options_required, false, false, 10)
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
self.main.pack_start(@frame_advanced, false, false, 10)
|
next if (opt.evasion?)
|
||||||
self.main.pack_start(@frame_evasion, false, false, 10)
|
next if (opt.advanced?)
|
||||||
|
@options_standard.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
|
end
|
||||||
|
|
||||||
# Standards options
|
# Advanced options
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
next if (opt.evasion?)
|
next if (!opt.advanced?)
|
||||||
next if (opt.advanced?)
|
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Advanced options
|
# Evasion options
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
next if (!opt.advanced?)
|
next if (!opt.evasion?)
|
||||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
@options_evasion.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Evasion options
|
# Display
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
indent = Gtk::HBox.new(false, 5)
|
||||||
next if (!opt.evasion?)
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
@options_evasion.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
indent.pack_start(@options_standard, false, false, 0)
|
||||||
end
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
|
@frame_standard.add(indent)
|
||||||
|
|
||||||
# Display
|
indent = Gtk::HBox.new(false, 5)
|
||||||
@frame_advanced.set_label("Advanced")
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
@frame_advanced.add(@options_advanced)
|
indent.pack_start(@options_advanced, false, false, 0)
|
||||||
@frame_evasion.set_label("Evasion")
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
@frame_evasion.add(@options_evasion)
|
@frame_advanced.add(indent)
|
||||||
|
|
||||||
self.main.show_all
|
indent = Gtk::HBox.new(false, 5)
|
||||||
end
|
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
|
# Put all values in a hash
|
||||||
#
|
#
|
||||||
def dump_to_hash
|
def dump_to_hash
|
||||||
@options_required.each do |widget|
|
@options_standard.each do |widget|
|
||||||
name, value = widget.get_pair
|
name, value = widget.get_pair
|
||||||
begin
|
begin
|
||||||
if (@mydriver.exploit.options[name].default.to_s == value)
|
if (@mydriver.exploit.options[name].default.to_s == value)
|
||||||
|
@ -263,7 +296,7 @@ module Msf
|
||||||
end
|
end
|
||||||
|
|
||||||
if (errors.empty? == false)
|
if (errors.empty? == false)
|
||||||
MsfDialog::Error.new(self, "Failed to validate : #{errors.join(', ')}")
|
MsfDialog::Error.new(self, "Failed to validate: #{errors.join(', ')}")
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
@ -281,7 +314,7 @@ module Msf
|
||||||
label = Gtk::Label.new
|
label = Gtk::Label.new
|
||||||
review = "\n\n"
|
review = "\n\n"
|
||||||
@hash.each do |key, value|
|
@hash.each do |key, value|
|
||||||
review << "<b>#{key}</b> : #{value}\n"
|
review << "<b>#{key}</b>: #{value}\n"
|
||||||
end
|
end
|
||||||
label.set_markup(review)
|
label.set_markup(review)
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Msf
|
||||||
@hash = {}
|
@hash = {}
|
||||||
|
|
||||||
# Call the parent
|
# Call the parent
|
||||||
super(@active_module.refname)
|
super(@active_module.name)
|
||||||
|
|
||||||
# Initialize exploit driver's exploit instance
|
# Initialize exploit driver's exploit instance
|
||||||
@mydriver = Msf::ExploitDriver.new(framework)
|
@mydriver = Msf::ExploitDriver.new(framework)
|
||||||
|
@ -65,12 +65,7 @@ module Msf
|
||||||
# Populate the datastore if possible
|
# Populate the datastore if possible
|
||||||
@mydriver.exploit.load_config
|
@mydriver.exploit.load_config
|
||||||
|
|
||||||
# Main interface
|
initialize_options()
|
||||||
@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)
|
|
||||||
|
|
||||||
# Begin the wizard
|
# Begin the wizard
|
||||||
target_completion()
|
target_completion()
|
||||||
|
@ -141,6 +136,7 @@ module Msf
|
||||||
[@label_review] # next
|
[@label_review] # next
|
||||||
)
|
)
|
||||||
display()
|
display()
|
||||||
|
initialize_options()
|
||||||
options_completion()
|
options_completion()
|
||||||
elsif (self.page == "options")
|
elsif (self.page == "options")
|
||||||
if not validate()
|
if not validate()
|
||||||
|
@ -150,6 +146,7 @@ module Msf
|
||||||
[@label_review] # next
|
[@label_review] # next
|
||||||
)
|
)
|
||||||
display()
|
display()
|
||||||
|
initialize_options()
|
||||||
options_completion()
|
options_completion()
|
||||||
else
|
else
|
||||||
self.page = "end"
|
self.page = "end"
|
||||||
|
@ -190,6 +187,7 @@ module Msf
|
||||||
[@label_review]
|
[@label_review]
|
||||||
)
|
)
|
||||||
display()
|
display()
|
||||||
|
initialize_options()
|
||||||
options_completion()
|
options_completion()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -301,105 +299,117 @@ module Msf
|
||||||
self.main.show_all
|
self.main.show_all
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
|
||||||
# Display options view
|
|
||||||
#
|
|
||||||
def options_completion
|
|
||||||
|
|
||||||
# Expanded frame
|
#
|
||||||
@frame_advanced.each do |widget|
|
# Instantiate the options page controls
|
||||||
@frame_advanced.remove(widget)
|
#
|
||||||
end
|
def initialize_options
|
||||||
@frame_evasion.each do |widget|
|
@frame_standard = Gtk::Expander.new("Standard")
|
||||||
@frame_evasion.remove(widget)
|
@frame_advanced = Gtk::Expander.new("Advanced")
|
||||||
end
|
@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)
|
||||||
|
|
||||||
# Required
|
@framer = Gtk::VBox.new(false, 10)
|
||||||
@options_required.each do |widget|
|
@scroller = Gtk::ScrolledWindow.new
|
||||||
@options_required.remove(widget)
|
@scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||||||
end
|
@scroller.set_size_request(580, 420)
|
||||||
|
|
||||||
# Advanced
|
@viewport = Gtk::Viewport.new(@scroller.hadjustment, @scroller.vadjustment)
|
||||||
@options_advanced.each do |widget|
|
|
||||||
@options_advanced.remove(widget)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Evasion
|
@frame_standard.expanded = true
|
||||||
@options_evasion.each do |widget|
|
end
|
||||||
@options_evasion.remove(widget)
|
|
||||||
end
|
#
|
||||||
|
# Display options view
|
||||||
|
#
|
||||||
|
def options_completion
|
||||||
|
self.page = "options"
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
# Standard options
|
||||||
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
|
next if (opt.evasion?)
|
||||||
|
next if (opt.advanced?)
|
||||||
|
@options_standard.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Advanced options
|
||||||
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
|
next if (!opt.advanced?)
|
||||||
|
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Evasion options
|
||||||
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
|
next if (!opt.evasion?)
|
||||||
|
@options_evasion.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
# Pack
|
indent = Gtk::HBox.new(false, 5)
|
||||||
self.main.pack_start(@options_required, false, false, 10)
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
|
indent.pack_start(@options_standard, false, false, 0)
|
||||||
# TODO
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
#self.main.pack_start(@frame_advanced, false, false, 10)
|
@frame_standard.add(indent)
|
||||||
#self.main.pack_start(@frame_evasion, false, false, 10)
|
|
||||||
|
|
||||||
#scrl = Gtk::ScrolledWindow.new
|
indent = Gtk::HBox.new(false, 5)
|
||||||
#scrl.shadow_type = Gtk::SHADOW_NONE
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
#scrl.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
indent.pack_start(@options_advanced, false, false, 0)
|
||||||
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
|
@frame_advanced.add(indent)
|
||||||
|
|
||||||
#vscr = Gtk::VBox.new
|
indent = Gtk::HBox.new(false, 5)
|
||||||
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
#vscr.pack_start(@options_required, false, false, 10)
|
indent.pack_start(@options_evasion, false, false, 0)
|
||||||
#vscr.pack_start(@frame_advanced, false, false, 10)
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
#vscr.pack_start(@frame_evasion, false, false, 10)
|
@frame_evasion.add(indent)
|
||||||
|
|
||||||
#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
|
labels = ["Standard", "Advanced", "Evasion"]
|
||||||
@mydriver.payload.options.each do |key, opt|
|
[@frame_standard, @frame_advanced, @frame_evasion].each do |obj|
|
||||||
next if (opt.advanced?)
|
txt = labels.shift
|
||||||
next if (opt.evasion?)
|
obj.spacing = 10
|
||||||
if (opt.required?)
|
obj.use_markup = true
|
||||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
obj.label = "<big><b>#{txt}</b></big>"
|
||||||
else
|
end
|
||||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Standards options
|
# Stuff it into a viewport
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@viewport.add(@framer)
|
||||||
next if (opt.evasion?)
|
|
||||||
next if (opt.advanced?)
|
|
||||||
@options_required.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Advanced options
|
# Stuff the viewport into a scrolledwindow
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@scroller.add(@viewport)
|
||||||
next if (!opt.advanced?)
|
|
||||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Evasion options
|
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
|
||||||
next if (!opt.evasion?)
|
|
||||||
@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)
|
|
||||||
|
|
||||||
self.main.show_all
|
|
||||||
end
|
|
||||||
|
|
||||||
|
# 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
|
# Put all values in a hash
|
||||||
#
|
#
|
||||||
def dump_to_hash
|
def dump_to_hash
|
||||||
@options_required.each do |widget|
|
@options_standard.each do |widget|
|
||||||
name, value = widget.get_pair
|
name, value = widget.get_pair
|
||||||
begin
|
begin
|
||||||
@hash[name] = value
|
@hash[name] = value
|
||||||
|
@ -455,7 +465,7 @@ module Msf
|
||||||
end
|
end
|
||||||
|
|
||||||
if (errors.empty? == false)
|
if (errors.empty? == false)
|
||||||
MsfDialog::Error.new(self, "Failed to validate : #{errors.join(', ')}")
|
MsfDialog::Error.new(self, "Failed to validate: #{errors.join(', ')}")
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
|
|
@ -253,27 +253,24 @@ module Msf
|
||||||
#
|
#
|
||||||
def create_banner
|
def create_banner
|
||||||
|
|
||||||
#
|
da = Gtk::DrawingArea.new
|
||||||
# Not use for this moment ...
|
da.set_size_request(600, 60)
|
||||||
#
|
|
||||||
# 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::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
|
return da
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue