class Nikto::XML::ScanDetails

Represents a ‘scandetails` XML element.

Public Class Methods

new(node) click to toggle source

Initializes the scan details object.

@param [Nokogiri::XML::Node] node

The XML node for the `scandetails` XML element.

@api private

# File lib/nikto/xml/scan_details.rb, line 21
def initialize(node)
  @node = node
end

Public Instance Methods

checks() click to toggle source

How many checks were performed on the target.

@return [Integer]

The parsed value of the `checks` attribute.
# File lib/nikto/xml/scan_details.rb, line 130
def checks
  @checks ||= @node['checks'].to_i
end
each_item() { |item| ... } click to toggle source

Enumerates over the found items.

@yield [item]

If a block is given, it will be passed each item object.

@yieldparam [Item] item

An item object.

@return [Enumerator]

If no block is given, an Enumerator object will be returned.
# File lib/nikto/xml/scan_details.rb, line 146
def each_item
  return enum_for(__method__) unless block_given?

  @node.xpath('item').each do |node|
    yield Item.new(node)
  end
end
errors() click to toggle source

How many errors occurred.

@return [Integer]

The parsed value of the `errors` attribute.
# File lib/nikto/xml/scan_details.rb, line 111
def errors
  @errors ||= @node['errors'].to_i
end
errors?() click to toggle source

Determines if any errors occurred.

@return [Boolean]

# File lib/nikto/xml/scan_details.rb, line 120
def errors?
  errors > 0
end
host_header() click to toggle source

The ‘Host` header.

@return [String]

The value of the `hostheader` attribute.
# File lib/nikto/xml/scan_details.rb, line 101
def host_header
  @node['hostheader']
end
items() click to toggle source

The found items for the target.

@return [Array<Item>]

# File lib/nikto/xml/scan_details.rb, line 159
def items
  each_item.to_a
end
site_ip() click to toggle source

The site’s IP address.

@return [String]

The value of the `siteip` attribute.
# File lib/nikto/xml/scan_details.rb, line 91
def site_ip
  @node['siteip']
end
site_name() click to toggle source

The site name.

@return [String]

The value of the `sitename` attribute.
# File lib/nikto/xml/scan_details.rb, line 81
def site_name
  @node['sitename']
end
start_time() click to toggle source

When the target started being scanned.

@return [Time]

The parsed value `starttime` attribute.
# File lib/nikto/xml/scan_details.rb, line 71
def start_time
  @start_time ||= Time.parse(@node['starttime'])
end
statistics() click to toggle source

The statistics associated with the scan.

@return [Statistics]

Represents the `statistics` XML element.
# File lib/nikto/xml/scan_details.rb, line 169
def statistics
  @statistics ||= Statistics.new(@node.at_xpath('statistics'))
end
target_banner() click to toggle source

The target’s banner value.

@return [String]

The value of the `targetbanner` attribute.
# File lib/nikto/xml/scan_details.rb, line 61
def target_banner
  @node['targetbanner']
end
target_hostname() click to toggle source

The target’s hostname.

@return [String]

The value of the `targethostname` attribute.
# File lib/nikto/xml/scan_details.rb, line 41
def target_hostname
  @node['targethostname']
end
target_ip() click to toggle source

The target’s IP address.

@return [String]

The value of the `targetip` attribute.
# File lib/nikto/xml/scan_details.rb, line 31
def target_ip
  @node['targetip']
end
target_port() click to toggle source

The target’s port number.

@return [Integer]

The parsed value of the `targetport` attribute.
# File lib/nikto/xml/scan_details.rb, line 51
def target_port
  @target_port ||= @node['targetport'].to_i
end