Saturday, August 13, 2016

Exporting workspaces from your MSF database


Quick and dirty hack to export all your findings/host/services/etc and creds from your metasploit database

Normally you'd do this with a:

workspace myworkspace
db_export -f xml -a /path/to/file.xml
db_export -f pwdump -a /path/to/file.pwdump

This can be tedious if you want to spin down an instance with tons of workspaces on it.  So I wrote a quick resource script to get it done.  This takes a list of workspaces. I'm sure you can programmatically retrieve the workspaces but I didn't.  Code below:



<ruby>
File.open("/root/workspaces.txt", "r") do |f|
f.each_line do |line|
run_single("workspace #{line}")
run_single("db_export -f xml -a /root/msf_workspace_export/#{line}_export_13Aug2016.xml")
run_single("db_export -f pwdump -a /root/msf_workspace_export/#{line}_export_13Aug2016.pwdump")
end
end
</ruby>


CG

1 comment:

Pentesteur said...

Hey! Five years later... THANKS! ...Was useful for me today ;)