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 = {}
|
@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,6 +89,11 @@ 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
|
|
||||||
|
|
||||||
# Evasion
|
#
|
||||||
@options_evasion.each do |widget|
|
# Display options view
|
||||||
@options_evasion.remove(widget)
|
#
|
||||||
end
|
def options_completion
|
||||||
|
self.page = "options"
|
||||||
|
|
||||||
# Pack
|
# Title and three sets of options
|
||||||
self.main.pack_start(@options_required, false, false, 10)
|
title = Gtk::Label.new
|
||||||
self.main.pack_start(@frame_advanced, false, false, 10)
|
title.set_markup("<big><b>#{@mydriver.exploit.name}</b></big>")
|
||||||
self.main.pack_start(@frame_evasion, false, false, 10)
|
@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)
|
||||||
|
|
||||||
# Standards options
|
# Standard options
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
next if (opt.evasion?)
|
next if (opt.evasion?)
|
||||||
next if (opt.advanced?)
|
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
|
end
|
||||||
|
|
||||||
# Advanced options
|
# Advanced options
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
next if (!opt.advanced?)
|
next if (!opt.advanced?)
|
||||||
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
@options_advanced.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Evasion options
|
# Evasion options
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
next if (!opt.evasion?)
|
next if (!opt.evasion?)
|
||||||
@options_evasion.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
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
@frame_advanced.set_label("Advanced")
|
indent = Gtk::HBox.new(false, 5)
|
||||||
@frame_advanced.add(@options_advanced)
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
@frame_evasion.set_label("Evasion")
|
indent.pack_start(@options_standard, false, false, 0)
|
||||||
@frame_evasion.add(@options_evasion)
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
|
@frame_standard.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_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
|
# 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
|
||||||
|
|
||||||
# Pack
|
# Advanced options
|
||||||
self.main.pack_start(@options_required, false, false, 10)
|
@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
|
||||||
|
|
||||||
# TODO
|
# Evasion options
|
||||||
#self.main.pack_start(@frame_advanced, false, false, 10)
|
@mydriver.exploit.options.sorted.each do |key, opt|
|
||||||
#self.main.pack_start(@frame_evasion, false, false, 10)
|
next if (!opt.evasion?)
|
||||||
|
@options_evasion.pack_start(add_option(key, opt, @mydriver.exploit.datastore[key]), false, false, 10)
|
||||||
|
end
|
||||||
|
|
||||||
#scrl = Gtk::ScrolledWindow.new
|
# Payload options
|
||||||
#scrl.shadow_type = Gtk::SHADOW_NONE
|
@mydriver.payload = framework.payloads.create(@hash["PAYLOAD"])
|
||||||
#scrl.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
@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
|
||||||
|
|
||||||
#vscr = Gtk::VBox.new
|
# 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)
|
||||||
|
|
||||||
#vscr.pack_start(@options_required, false, false, 10)
|
indent = Gtk::HBox.new(false, 5)
|
||||||
#vscr.pack_start(@frame_advanced, false, false, 10)
|
indent.pack_start(Gtk::Label.new(""), false, false, 5)
|
||||||
#vscr.pack_start(@frame_evasion, false, false, 10)
|
indent.pack_start(@options_advanced, false, false, 0)
|
||||||
|
indent.pack_start(Gtk::Label.new(""),true, true, 5)
|
||||||
|
@frame_advanced.add(indent)
|
||||||
|
|
||||||
#scrl.add_with_viewport(vscr)
|
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)
|
||||||
|
|
||||||
#self.main.pack_start(scrl, false, false, 20)
|
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
|
||||||
|
|
||||||
# Payload options
|
# Stuff it into a viewport
|
||||||
@mydriver.payload = framework.payloads.create(@hash["PAYLOAD"])
|
@viewport.add(@framer)
|
||||||
|
|
||||||
# Pack all options
|
# Stuff the viewport into a scrolledwindow
|
||||||
@mydriver.payload.options.each do |key, opt|
|
@scroller.add(@viewport)
|
||||||
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
|
# Stuff this into main and call it done
|
||||||
@mydriver.exploit.options.sorted.each do |key, opt|
|
self.main.pack_start(@scroller, true, true, 10)
|
||||||
next if (opt.evasion?)
|
self.main.show_all
|
||||||
next if (opt.advanced?)
|
end
|
||||||
@options_required.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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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