class Ncrack::XML::Service
Represents a ‘service` XML
element.
Public Class Methods
new(node)
click to toggle source
Initializes the service object.
@param [Nokogiri::XML::Node] node
The XML node for the `service` XML element.
@api private
# File lib/ncrack/xml/service.rb, line 20 def initialize(node) @node = node end
Public Instance Methods
address()
click to toggle source
The address information of the service.
@return [Address]
The `address` XML child element.
# File lib/ncrack/xml/service.rb, line 50 def address @address ||= Address.new(@node.at_xpath('address')) end
credential()
click to toggle source
The first bruteforced credential.
@return [Credential, nil]
# File lib/ncrack/xml/service.rb, line 98 def credential each_credentials.first end
credentials()
click to toggle source
The bruteforced credentials.
@return [Array<Credential>]
# File lib/ncrack/xml/service.rb, line 89 def credentials each_credentials.to_a end
each_credentials() { |credentials| ... }
click to toggle source
Enumerates over every bruteforced credential.
@yield [credential]
If a block is given it will be passed each bruteforced credential.
@yieldparam [Credential] credential
A bruteforced credential.
@return [Enumerator]
If no block is given, an Enumerator will be returned.
# File lib/ncrack/xml/service.rb, line 76 def each_credentials return enum_for(__method__) unless block_given? @node.xpath('credentials').each do |node| yield Credentials.new(node) end end
end_time()
click to toggle source
When bruteforcing of the service stopped.
@return [Time]
The parsed value of the `endtime` attribute.
# File lib/ncrack/xml/service.rb, line 40 def end_time @end_time ||= Time.at(@node['endtime'].to_i) end
port()
click to toggle source
The port information of the service.
@return [Port]
The `port` XML child element.
# File lib/ncrack/xml/service.rb, line 60 def port @port ||= Port.new(@node.at_xpath('port')) end
start_time()
click to toggle source
When bruteforcing of the service begin.
@return [Time]
The parsed value of the `starttime` attribute.
# File lib/ncrack/xml/service.rb, line 30 def start_time @start_time ||= Time.at(@node['starttime'].to_i) end