Class: Ronin::WebCredential

Inherits:
Credential show all
Defined in:
lib/ronin/web_credential.rb

Overview

Represents Credentials used to access websites at specified URLs.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Credential

#clear_text, for_user, #to_ary, #user, with_password

Methods included from Model

included

Class Method Details

.with_email(email) ⇒ Array<WebCredential>

Searches all web credentials that are associated with an email address.

Parameters:

  • email (String)

    The email address to search for.

Returns:

  • (Array<WebCredential>)

    The web credentials associated with the email address.

Since:

  • 1.0.0



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ronin/web_credential.rb', line 51

def self.with_email(email)
  unless email.include?('@')
    raise("invalid email address #{email.dump}")
  end

  user, domain = email.split('@',2)

  return all(
    'email_address.user_name.name' => user,
    'email_address.host_name.address' => domain
  )
end

Instance Method Details

#to_sString

Converts the web credential to a String.

Returns:

  • (String)

    The user name, clear-text password and the optional email address.

Since:

  • 1.0.0



74
75
76
77
78
79
80
# File 'lib/ronin/web_credential.rb', line 74

def to_s
  if self.email_address
    "#{super} (#{self.email_address})"
  else
    super
  end
end