Class: Nexpose::ActiveScan

Inherits:
CompletedScan show all
Defined in:
lib/nexpose/scan.rb

Instance Attribute Summary

Attributes inherited from CompletedScan

#assets, #duration, #end_time, #engine_name, #id, #risk_score, #site_id, #start_time, #status, #type, #vulns

Class Method Summary collapse

Methods inherited from CompletedScan

#initialize, parse_json

Constructor Details

This class inherits a constructor from Nexpose::CompletedScan

Class Method Details

._parse_status(code) ⇒ Object

Internal method to parsing status codes.



829
830
831
832
833
834
835
836
837
838
839
840
# File 'lib/nexpose/scan.rb', line 829

def self._parse_status(code)
  case code
  when 'U'
    :running
  when 'P'
    :paused
  when 'I'
    :integrating
  else
    :unknown
  end
end

.parse_dyntable(json) ⇒ Object



812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
# File 'lib/nexpose/scan.rb', line 812

def self.parse_dyntable(json)
  new do
    @id = json['Scan ID']
    @site_id = json['Site ID']
    @status = CompletedScan._parse_status(json['Status Code'])
    @start_time = Time.at(json['Started'].to_i / 1000)
    @end_time = Time.at(json['Progress'].to_i / 1000)
    @duration = json['Elapsed'].to_i
    @vulns = json['Vulnerabilities Discovered'].to_i
    @assets = json['Devices Discovered'].to_i
    @risk_score = json['riskScore']
    @type = json['Scan Type'] == 'Manual' ? :manual : :scheduled
    @engine_name = json['Scan Engine']
  end
end