Class: Ronin::Recon::Values::Domain

Inherits:
Host show all
Defined in:
lib/ronin/recon/values/domain.rb

Overview

Represents a domain name (ex: example.com).

Instance Attribute Summary

Attributes inherited from Host

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Host

#eql?, #hash, #initialize, #to_s

Methods inherited from Ronin::Recon::Value

#==, parse, #to_csv, #to_json, #to_s

Constructor Details

This class inherits a constructor from Ronin::Recon::Values::Host

Class Method Details

.value_type:domain

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.

Note:

This is used internally to map a recon value class to a printable type.

Returns the type or kind of recon value.

Returns:

  • (:domain)


85
86
87
# File 'lib/ronin/recon/values/domain.rb', line 85

def self.value_type
  :domain
end

Instance Method Details

#===(other) ⇒ Boolean

Case equality method used for fuzzy matching.

Parameters:

  • other (Value)

    The other value to compare.

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ronin/recon/values/domain.rb', line 46

def ===(other)
  case other
  when Domain
    @name == other.name
  when Host
    other.name.end_with?(".#{@name}")
  when IP, Website, URL
    if (other_host = other.host)
      other_host == @name || other_host.end_with?(".#{@name}")
    end
  when EmailAddress
    other.address.end_with?("@#{@name}") ||
      other.address.end_with?(".#{@name}")
  else
    false
  end
end

#as_jsonHash{Symbol => Object}

Coerces the domain value into JSON.

Returns:

  • (Hash{Symbol => Object})

    The Ruby Hash that will be converted into JSON.



70
71
72
# File 'lib/ronin/recon/values/domain.rb', line 70

def as_json
  {type: :domain, name: @name}
end