class SSLyze::XML
Represents the XML
output from sslyze.
Public Class Methods
new(doc)
click to toggle source
Initializes the XML
.
@param [Nokogiri::XML::Document] doc
The XML document.
# File lib/sslyze/xml.rb, line 25 def initialize(doc) @doc = doc end
open(path)
click to toggle source
Opens the XML
file.
@param [String] path
Path to the XML file.
@return [XML]
# File lib/sslyze/xml.rb, line 49 def self.open(path) new(File.open(path) { |file| Nokogiri::XML(file) }) end
parse(xml)
click to toggle source
Parses the XML
.
@param [String] xml
The raw XML.
@return [XML]
# File lib/sslyze/xml.rb, line 37 def self.parse(xml) new(Nokogiri::XML.parse(xml)) end
Public Instance Methods
each_invalid_target() { |invalid_target| ... }
click to toggle source
Enumerates over each invalid target.
@yield [invalidtarget]
@yieldparam [InvalidTarget] invalid_target
@return [Enumerator]
@since 0.2.0
# File lib/sslyze/xml.rb, line 96 def each_invalid_target return enum_for(__method__) unless block_given? @doc.xpath('/document/invalidTargets/invalidTarget').each do |inval| yield InvalidTarget.new(inval) end end
each_target() { |target| ... }
click to toggle source
Enumerates over each target.
@yield [target]
@yieldparam [Target] target
@return [Enumerator]
# File lib/sslyze/xml.rb, line 124 def each_target return enum_for(__method__) unless block_given? @doc.xpath('/document/results/target').each do |target| yield Target.new(target) end end
Also aliased as: each
invalid_targets()
click to toggle source
@return [Array<InvalidTarget>]
@see each_invalid_target
@since 0.2.0
# File lib/sslyze/xml.rb, line 111 def invalid_targets each_invalid_target.to_a end
network_timeout()
click to toggle source
The default timeout used.
@return [Integer, nil]
@since 1.0.0
# File lib/sslyze/xml.rb, line 69 def network_timeout @default_time ||= if (attr = @doc.at_xpath('/document/results/@networkTimeout')) attr.value.to_i end end
target()
click to toggle source
The first target.
@return [Target, nil]
# File lib/sslyze/xml.rb, line 148 def target each_target.first end
targets()
click to toggle source
@return [Array<Target>]
@see each_target
# File lib/sslyze/xml.rb, line 139 def targets each_target.to_a end
total_scan_time()
click to toggle source
Duration of the scan.
@return [Float, nil]
# File lib/sslyze/xml.rb, line 80 def total_scan_time @total_scan_time ||= if (attr = @doc.at_xpath('/document/results/@totalScanTime')) attr.value.to_f end end
version()
click to toggle source
The version of the XML
output.
@return [String]
# File lib/sslyze/xml.rb, line 58 def version @version ||= @doc.at_xpath('/document/@SSLyzeVersion').value end