Sha256: adf206aa03ca4b34bd59cb1028c24664ba6106775b9f8ab7a9b46655757d6d6b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))

require 'rubygems'
require 'nessus'

# Ruby-Nessus Example
#
# This proc is called by scan.each_host in each variation of Nessus::Parse
def print_info(host)
  puts host.ip
  puts host.hostname
  puts host.os_name
  puts host.runtime

  # puts host.mac_addr
  # puts host.event_percentage_for('icmp', true)
  # puts host.ports.inspect

  host.each_event do |event|
    puts "=> #{event.name}" if event.name
    # puts event.synopsis if event.synopsis
    # puts "\n"
    # puts event.output
    # puts "\n"
    # puts event.patch_publication_date.pretty if event.patch_publication_data
    # puts event.see_also unless event.see_also.empty?
    # puts event.synopsis if event.synopsis
    # puts event.solution if event.solution
  end
end

# From a file:
puts '+ Using a Nessus XML file:'
Nessus::Parse.new('example_v1.nessus') do |scan|
  scan.each_host(&method(:print_info))
end

puts

# From a string:
puts '+ Using an XML string:'
Nessus::Parse.new(nil, { :xml => File.read('example_v1.nessus') }) do |scan|
  scan.each_host(&method(:print_info))
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-nessus-1.2.0 examples/example.rb