diff --git a/lib/msf/ui/gtk2/assistant/exploit.rb b/lib/msf/ui/gtk2/assistant/exploit.rb index 6c892f65d4..9eabd50914 100644 --- a/lib/msf/ui/gtk2/assistant/exploit.rb +++ b/lib/msf/ui/gtk2/assistant/exploit.rb @@ -41,6 +41,8 @@ module Msf ) end + include Msf::Ui::Gtk2::MyControls + # # Init # @@ -56,11 +58,11 @@ module Msf # Initialize exploit driver's exploit instance @mydriver = Msf::ExploitDriver.new(framework) @mydriver.exploit = framework.exploits.create(@active_module.refname) - + # Populate the datastore if possible @mydriver.exploit.load_config # p @mydriver.exploit.datastore - + # Main interface @model_required = Gtk::ListStore.new(String, String, String, String) @@ -92,20 +94,16 @@ module Msf # Save configuration for MsfAssistant # def save - # Save the console config - $gtk2driver.save_config(@mydriver.exploit) + @mydriver.exploit.datastore.import_options_from_hash(@hash, imported = false) + @mydriver.payload.share_datastore(@mydriver.exploit.datastore) + + # TODO: choose the $gtk2driver or @mydriver.exploit ? + $gtk2driver.active_module = @mydriver.exploit + $gtk2driver.save_config # Save the framework's datastore - begin - framework.save_config - - if (@mydriver.exploit) - @mydriver.exploit.save_config - end - rescue - MsfDialog::Error.new(self, "Failed to save config file") - return false - end + framework.save_config + @mydriver.exploit.datastore.to_file(Msf::Config.config_file, @mydriver.exploit.refname) $gtk2driver.append_log_view("Saved configuration to: #{Msf::Config.config_file}\n") end @@ -245,18 +243,18 @@ module Msf # Model for Gtk::Combox model_all = Gtk::ListStore.new(String, Object) - + index = "" # Add iter to Model @active_module.compatible_payloads.each_with_index do |key, idx| iter = model_all.append - + # refname iter[0] = key[0] # payload iter[1] = key[1] - + if ( @mydriver.exploit.datastore['PAYLOAD'] == key[0]) index = idx end @@ -494,5 +492,3 @@ module Msf end end end - - diff --git a/lib/msf/ui/gtk2/driver.rb b/lib/msf/ui/gtk2/driver.rb index cd6f1b64f0..f64e5d8392 100644 --- a/lib/msf/ui/gtk2/driver.rb +++ b/lib/msf/ui/gtk2/driver.rb @@ -92,7 +92,7 @@ module Msf # # Saves configuration for MsfAssistant. # - def save_config(active_module) + def save_config # Build out the assistant config group group = {} @@ -150,6 +150,11 @@ module Msf # The framework instance associated with this driver. # attr_reader :framework + + # + # The active module associated with the driver. + # + attr_accessor :active_module protected