Skip to content

Commit c55e200

Browse files
committed
Add workspace saving to msfconsole's save command
1 parent f4977bf commit c55e200

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/msf/ui/console/driver.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,17 @@ def load_config(path=nil)
387387
if (conf.group?(ConfigGroup))
388388
conf[ConfigGroup].each_pair { |k, v|
389389
case k.downcase
390-
when "activemodule"
390+
when 'activemodule'
391391
run_single("use #{v}")
392+
when 'activeworkspace'
393+
if framework.db.active
394+
workspace = framework.db.find_workspace(v)
395+
if workspace
396+
framework.db.workspace = workspace
397+
else
398+
framework.db.workspace = framework.db.add_workspace(v)
399+
end
400+
end
392401
end
393402
}
394403
end
@@ -405,6 +414,12 @@ def save_config
405414
group['ActiveModule'] = active_module.fullname
406415
end
407416

417+
if framework.db.active
418+
unless framework.db.workspace.default?
419+
group['ActiveWorkspace'] = framework.db.workspace.name
420+
end
421+
end
422+
408423
# Save it
409424
begin
410425
Msf::Config.save(ConfigGroup => group)

0 commit comments

Comments
 (0)