support save_config and many changes on MsfAssistant
git-svn-id: file:///home/svn/framework3/trunk@4909 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
36b6da19fd
commit
938e9bf5ad
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue