Method: Nmap::XML#scan_info

Defined in:
lib/nmap/xml.rb

#scan_infoArray<Scan>

Parses the scan information.

Returns:

  • (Array<Scan>)

    The scan information.

[View source]

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/nmap/xml.rb', line 125

def scan_info
  @doc.xpath('/nmaprun/scaninfo').map do |scaninfo|
    Scan.new(
      scaninfo['type'].to_sym,
      scaninfo['protocol'].to_sym,
      scaninfo['services'].split(',').map { |ports|
        if ports.include?('-')
          Range.new(*(ports.split('-',2)))
        else
          ports.to_i
        end
      }
    )
  end
end