Class: Nexpose::AssetScan

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/device.rb

Overview

Summary object of a scan for a particular asset.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ AssetScan

Internal constructor to be called by #parse_json.



253
254
255
# File 'lib/nexpose/device.rb', line 253

def initialize(&block)
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#asset_idObject (readonly)

Unique identifier of an asset.



232
233
234
# File 'lib/nexpose/device.rb', line 232

def asset_id
  @asset_id
end

#end_timeObject (readonly)

Time when the asset finished scanning.



244
245
246
# File 'lib/nexpose/device.rb', line 244

def end_time
  @end_time
end

#engine_nameObject (readonly)

Name of the scan engine used for the scan.



250
251
252
# File 'lib/nexpose/device.rb', line 250

def engine_name
  @engine_name
end

#host_nameObject (readonly)

Host name of the asset, if discovered.



236
237
238
# File 'lib/nexpose/device.rb', line 236

def host_name
  @host_name
end

#ipObject (readonly)

IP address of the asset.



234
235
236
# File 'lib/nexpose/device.rb', line 234

def ip
  @ip
end

#osObject (readonly)

Operating system fingerprint of the asset.



248
249
250
# File 'lib/nexpose/device.rb', line 248

def os
  @os
end

#scan_idObject (readonly)

Unique identifier for the scan.



242
243
244
# File 'lib/nexpose/device.rb', line 242

def scan_id
  @scan_id
end

#site_idObject (readonly)

Unique identifier for the site where the scan originated.



240
241
242
# File 'lib/nexpose/device.rb', line 240

def site_id
  @site_id
end

#site_nameObject (readonly)

Site name where the scan originated.



238
239
240
# File 'lib/nexpose/device.rb', line 238

def site_name
  @site_name
end

#vulnsObject (readonly)

Number of vulnerabilities discovered on the asset.



246
247
248
# File 'lib/nexpose/device.rb', line 246

def vulns
  @vulns
end

Class Method Details

.parse_json(json) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/nexpose/device.rb', line 257

def self.parse_json(json)
  new do
    @asset_id = json['assetID'].to_i
    @scan_id = json['scanID'].to_i
    @site_id = json['siteID'].to_i
    @ip = json['ipAddress']
    @host_name = json['hostname']
    @os = json['operatingSystem']
    @vulns = json['vulnCount']
    @end_time = Time.at(json['completed'].to_i / 1000)
    @site_name = json['siteName']
    @engine_name = json['scanEngineName']
  end
end