diff --git a/lib/msf/ui/console/driver.rb b/lib/msf/ui/console/driver.rb index d4d7b30953..e9dfc0b0be 100644 --- a/lib/msf/ui/console/driver.rb +++ b/lib/msf/ui/console/driver.rb @@ -387,8 +387,17 @@ class Driver < Msf::Ui::Driver if (conf.group?(ConfigGroup)) conf[ConfigGroup].each_pair { |k, v| case k.downcase - when "activemodule" + when 'activemodule' run_single("use #{v}") + when 'activeworkspace' + if framework.db.active + workspace = framework.db.find_workspace(v) + if workspace + framework.db.workspace = workspace + else + framework.db.workspace = framework.db.add_workspace(v) + end + end end } end @@ -405,6 +414,12 @@ class Driver < Msf::Ui::Driver group['ActiveModule'] = active_module.fullname end + if framework.db.active + unless framework.db.workspace.default? + group['ActiveWorkspace'] = framework.db.workspace.name + end + end + # Save it begin Msf::Config.save(ConfigGroup => group)