Class: Nikto::XML::ScanDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/nikto/xml/scan_details.rb

Overview

Represents a scandetails XML element.

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ ScanDetails

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the scan details object.

Parameters:

  • node (Nokogiri::XML::Node)

    The XML node for the scandetails XML element.



21
22
23
# File 'lib/nikto/xml/scan_details.rb', line 21

def initialize(node)
  @node = node
end

Instance Method Details

#checksInteger

How many checks were performed on the target.

Returns:

  • (Integer)

    The parsed value of the checks attribute.



130
131
132
# File 'lib/nikto/xml/scan_details.rb', line 130

def checks
  @checks ||= @node['checks'].to_i
end

#each_item {|item| ... } ⇒ Enumerator

Enumerates over the found items.

Yields:

  • (item)

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

Yield Parameters:

  • item (Item)

    An item object.

Returns:

  • (Enumerator)

    If no block is given, an Enumerator object will be returned.



146
147
148
149
150
151
152
# 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

#errorsInteger

How many errors occurred.

Returns:

  • (Integer)

    The parsed value of the errors attribute.



111
112
113
# File 'lib/nikto/xml/scan_details.rb', line 111

def errors
  @errors ||= @node['errors'].to_i
end

#errors?Boolean

Determines if any errors occurred.

Returns:

  • (Boolean)


120
121
122
# File 'lib/nikto/xml/scan_details.rb', line 120

def errors?
  errors > 0
end

#host_headerString

The Host header.

Returns:

  • (String)

    The value of the hostheader attribute.



101
102
103
# File 'lib/nikto/xml/scan_details.rb', line 101

def host_header
  @node['hostheader']
end

#itemsArray<Item>

The found items for the target.

Returns:



159
160
161
# File 'lib/nikto/xml/scan_details.rb', line 159

def items
  each_item.to_a
end

#site_ipString

The site's IP address.

Returns:

  • (String)

    The value of the siteip attribute.



91
92
93
# File 'lib/nikto/xml/scan_details.rb', line 91

def site_ip
  @node['siteip']
end

#site_nameString

The site name.

Returns:

  • (String)

    The value of the sitename attribute.



81
82
83
# File 'lib/nikto/xml/scan_details.rb', line 81

def site_name
  @node['sitename']
end

#start_timeTime

When the target started being scanned.

Returns:

  • (Time)

    The parsed value starttime attribute.



71
72
73
# File 'lib/nikto/xml/scan_details.rb', line 71

def start_time
  @start_time ||= Time.parse(@node['starttime'])
end

#statisticsStatistics

The statistics associated with the scan.

Returns:

  • (Statistics)

    Represents the statistics XML element.



169
170
171
# File 'lib/nikto/xml/scan_details.rb', line 169

def statistics
  @statistics ||= Statistics.new(@node.at_xpath('statistics'))
end

#target_bannerString

The target's banner value.

Returns:

  • (String)

    The value of the targetbanner attribute.



61
62
63
# File 'lib/nikto/xml/scan_details.rb', line 61

def target_banner
  @node['targetbanner']
end

#target_hostnameString

The target's hostname.

Returns:

  • (String)

    The value of the targethostname attribute.



41
42
43
# File 'lib/nikto/xml/scan_details.rb', line 41

def target_hostname
  @node['targethostname']
end

#target_ipString

The target's IP address.

Returns:

  • (String)

    The value of the targetip attribute.



31
32
33
# File 'lib/nikto/xml/scan_details.rb', line 31

def target_ip
  @node['targetip']
end

#target_portInteger

The target's port number.

Returns:

  • (Integer)

    The parsed value of the targetport attribute.



51
52
53
# File 'lib/nikto/xml/scan_details.rb', line 51

def target_port
  @target_port ||= @node['targetport'].to_i
end