Class: Ncrack::XML::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/ncrack/xml/credentials.rb

Overview

Represents a credentials XML element.

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Credentials

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 credentials object.

Parameters:

  • node (Nokogiri::XML::Node)

    The XML node for the credentials XML element.



16
17
18
# File 'lib/ncrack/xml/credentials.rb', line 16

def initialize(node)
  @node = node
end

Instance Method Details

#passwordString

The successfully bruteforced password.

Returns:

  • (String)

    The value of the password attribute.



38
39
40
# File 'lib/ncrack/xml/credentials.rb', line 38

def password
  @password ||= @node['password']
end

#to_a(String, String)

Converts the credentials to a String.

Returns:



58
59
60
# File 'lib/ncrack/xml/credentials.rb', line 58

def to_a
  [username, password]
end

#to_sString

Converts the credentials to a String.

Returns:

  • (String)

    Returns a "username:password" String.



48
49
50
# File 'lib/ncrack/xml/credentials.rb', line 48

def to_s
  "#{username}:#{password}"
end

#usernameString Also known as: user_name

The successfully bruteforced username.

Returns:

  • (String)

    The value of the username attribute.



26
27
28
# File 'lib/ncrack/xml/credentials.rb', line 26

def username
  @username ||= @node['username']
end