Ruby library for Nessus XMLRPC interface and Nessus command line example of using Ruby library. This library is used for communication with Nessus over XML RPC interface. You can start, stop, pause and resume scan. Watch progress and status of scan, download report, etc.
This library won't parse your reports. If you need to parse Nessus XML reports (.nessus v1 & v2), take a look at the excellent ruby-nessus library.
require 'uri' require 'net/https' require 'rexml/document'This library can use nokogiri. If nokogiri is found, library will use nokogiri automatically for XML parsing (insted of rexml) in order to get some speed.
gem install nessus-xmlrpc
# require 'rubygems' # if using Ruby <1.9
require 'nessus-xmlrpc'
n=NessusXMLRPC::NessusXMLRPC.new('','user','pass');
if n.logged_in
id,name = n.policy_get_first
puts "using policy ID: " + id + " with name: " + name
uid=n.scan_new(id,"textxmlrpc","127.0.0.1")
puts "status: " + n.scan_status(uid)
while not n.scan_finished(uid)
sleep 10
end
content=n.report_file_download(uid)
File.open('report.xml', 'w') {|f| f.write(content) }
end
For full API/class documentation, visit rdoc documentation pages.
You can see more ruby examples on wiki.
Command line example
./nessus-cli.rb --user john --password doe --scan scan-localhost --verbose --wait --output report.xml --target localhostYou can see more command line examples on wiki.
git clone git://rubyforge.org/nessus-xmlrpc.git
For some ideas, take a look at the TODO on git
After 0.2 release, I got unofficial test.html from Renaud Deraison which can help in learning how protocol works.
Feel free to contribute to the knowledge on wiki. Used wiki is UseModWiki and syntax is described here.