Usable, fast, simple Ruby gem for Tenable Nessus Pro from v7.0.1 to v8.3.1 NessusClient was designed to be simple, fast and performant through communication with Nessus over REST interface.
Ruby gem for Nessus API
Code and Bug Reports
- Issue Tracker
- See CONTRIBUTING for how to contribute along with some common problems to check out before creating an issue.
require 'nessus_client'
nc = NessusClient.new( { :uri=>'https://localhost:8834', :username=>'username',:password=> 'password'} )
status = nc.server_status
puts status
puts nc.server_properties
if status['status'] == 'ready'
scan_id = nc.get_scan_by_name('Monthly Scan')
scan_uuid = nc.launch_by_name( 'Monthly Scan', ['127.0.0.1'])['scan_uuid']
loop do
puts `clear`
scan_status = nc.scan_details( scan_id )["info"]["status"]
puts " #{scan_id} - #{scan_uuid} - #{scan_status} "
sleep 5
if ["completed","canceled"].include? scan_status
export_request = nc.export_request(scan_id, "nessus" )
puts " export request: #{export_request}"
while true do
puts `clear`
export_status = nc.token_status( export_request['token'])["status"]
puts " export status: #{export_status}"
sleep 5
if export_status == "ready"
puts " downloading..."
open("scan_report", "wb") do |file|
file.write(nc.token_download( export_request['token'] ))
end
exit 0
end
end
end
end
end
Add this line to your application's Gemfile:
gem 'nessus_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nessus_client
Requirements are Exon for HTTP(S) and Oj parsing:
require 'excon'
require 'oj'
Everyone participating in this project's development, issue trackers and other channels is expected to follow our Code of Conduct.
See the contributing guide.
Copyright (c) 2016-2019 Heyder Andrade. See MIT-LICENSE for details.