class Nexpose::Site
Public Instance Methods
load_csv_hostnames(nsc, csvfile)
click to toggle source
Load asset hostnames from a CSV file.
@param nsc [Connection] an active connection to a Nexpose
console. @param csvfile [String] path to a CSV file to load hostnames from. (The first column will be used.)
# File lib/nexpose-functions.rb, line 133 def load_csv_hostnames(nsc, csvfile) puts "Loading site..." @site = Site.load(@nsc, self.id) puts "Building hostname/asset list..." @hostnames = [] CSV.foreach(@csvfile) do |line| @hostnames << HostName.new(line[0]) end puts "Saving site assets..." @site.included_addresses = @hostnames @site.save(@nsc) puts "Done." puts "Site #{self.id} now has #{@hostnames.length} assets." end