Skip to content

Instantly share code, notes, and snippets.

@brandonprry
Created October 2, 2014 13:13
Show Gist options
  • Save brandonprry/c13e77204d9a8389fee4 to your computer and use it in GitHub Desktop.
Save brandonprry/c13e77204d9a8389fee4 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'nexpose'
require 'msfrpc-client'
nx_host = 'nxhost'
nx_port = 3780
nx_user = 'nxadmin'
nx_pass = 'nxpassword'
msf_host = 'msfprohost'
msf_port = 3790
msf_user = 'msfadmin'
msf_pass = 'msfpassword'
p "Authentication with Nexpose..."
nsc = Nexpose::Connection.new(nx_host, nx_user, nx_pass, nx_port)
nsc.login
opts = {
:user => msf_user,
:pass => msf_pass,
:host => msf_host,
:port => msf_port
}
msfrpc = Msf::RPC::Client.new(opts)
sites = nsc.list_sites
current_projects = msfrpc.call('pro.workspaces')
sites.each do |site|
next if current_projects[site.name]
p "Adding site: " + site.name
opts = {
"name" => site.name,
}
msfrpc.call('pro.project_add', opts)
end
@hdm
Copy link

hdm commented Oct 3, 2014

Y U NO IMPORT SITE DATA! =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment