Nessus XMLRPC implementation in Ruby

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.

  • Requirements
  • Requirements are quite standard Ruby libraries for HTTPS and XML parsing:
    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.

  • Installation
  • If you have gem, you can basically say:
    gem install nessus-xmlrpc
    

  • Download
  • You can download library and command line example here
    You can reach RubyForge page here

  • Examples
  • How easy to write some scan?
    # 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 localhost
    
    You can see more command line examples on wiki.

  • Documentation
  • For full API/class documentation of Ruby library, visit rdoc documentation pages.

  • Development
  • You can browse git tree here.
    To pull the 'nessus-xmlrpc' repository anonymously, use:
            git clone git://rubyforge.org/nessus-xmlrpc.git
    
    For some ideas, take a look at the TODO on git

  • XMLRPC Protocol
  • So, far, there is only few sources of how Nessus XMLRPC works: blog.upbeat.fr is one of the best ones.

    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.


    Distributed under GPL