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
|
end
|
||||||
|
|
||||||
|
include Msf::Ui::Gtk2::MyControls
|
||||||
|
|
||||||
#
|
#
|
||||||
# Init
|
# Init
|
||||||
#
|
#
|
||||||
|
@ -56,11 +58,11 @@ module Msf
|
||||||
# Initialize exploit driver's exploit instance
|
# Initialize exploit driver's exploit instance
|
||||||
@mydriver = Msf::ExploitDriver.new(framework)
|
@mydriver = Msf::ExploitDriver.new(framework)
|
||||||
@mydriver.exploit = framework.exploits.create(@active_module.refname)
|
@mydriver.exploit = framework.exploits.create(@active_module.refname)
|
||||||
|
|
||||||
# Populate the datastore if possible
|
# Populate the datastore if possible
|
||||||
@mydriver.exploit.load_config
|
@mydriver.exploit.load_config
|
||||||
# p @mydriver.exploit.datastore
|
# p @mydriver.exploit.datastore
|
||||||
|
|
||||||
|
|
||||||
# Main interface
|
# Main interface
|
||||||
@model_required = Gtk::ListStore.new(String, String, String, String)
|
@model_required = Gtk::ListStore.new(String, String, String, String)
|
||||||
|
@ -92,20 +94,16 @@ module Msf
|
||||||
# Save configuration for MsfAssistant
|
# Save configuration for MsfAssistant
|
||||||
#
|
#
|
||||||
def save
|
def save
|
||||||
# Save the console config
|
@mydriver.exploit.datastore.import_options_from_hash(@hash, imported = false)
|
||||||
$gtk2driver.save_config(@mydriver.exploit)
|
@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
|
# Save the framework's datastore
|
||||||
begin
|
framework.save_config
|
||||||
framework.save_config
|
@mydriver.exploit.datastore.to_file(Msf::Config.config_file, @mydriver.exploit.refname)
|
||||||
|
|
||||||
if (@mydriver.exploit)
|
|
||||||
@mydriver.exploit.save_config
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
MsfDialog::Error.new(self, "Failed to save config file")
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
$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
|
||||||
|
@ -245,18 +243,18 @@ module Msf
|
||||||
|
|
||||||
# Model for Gtk::Combox
|
# Model for Gtk::Combox
|
||||||
model_all = Gtk::ListStore.new(String, Object)
|
model_all = Gtk::ListStore.new(String, Object)
|
||||||
|
|
||||||
index = ""
|
index = ""
|
||||||
|
|
||||||
# Add iter to Model
|
# Add iter to Model
|
||||||
@active_module.compatible_payloads.each_with_index do |key, idx|
|
@active_module.compatible_payloads.each_with_index do |key, idx|
|
||||||
iter = model_all.append
|
iter = model_all.append
|
||||||
|
|
||||||
# refname
|
# refname
|
||||||
iter[0] = key[0]
|
iter[0] = key[0]
|
||||||
# payload
|
# payload
|
||||||
iter[1] = key[1]
|
iter[1] = key[1]
|
||||||
|
|
||||||
if ( @mydriver.exploit.datastore['PAYLOAD'] == key[0])
|
if ( @mydriver.exploit.datastore['PAYLOAD'] == key[0])
|
||||||
index = idx
|
index = idx
|
||||||
end
|
end
|
||||||
|
@ -494,5 +492,3 @@ module Msf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ module Msf
|
||||||
#
|
#
|
||||||
# Saves configuration for MsfAssistant.
|
# Saves configuration for MsfAssistant.
|
||||||
#
|
#
|
||||||
def save_config(active_module)
|
def save_config
|
||||||
# Build out the assistant config group
|
# Build out the assistant config group
|
||||||
group = {}
|
group = {}
|
||||||
|
|
||||||
|
@ -150,6 +150,11 @@ module Msf
|
||||||
# The framework instance associated with this driver.
|
# The framework instance associated with this driver.
|
||||||
#
|
#
|
||||||
attr_reader :framework
|
attr_reader :framework
|
||||||
|
|
||||||
|
#
|
||||||
|
# The active module associated with the driver.
|
||||||
|
#
|
||||||
|
attr_accessor :active_module
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue