Class: Ronin::Recon::Scope Private
- Inherits:
-
Object
- Object
- Ronin::Recon::Scope
- Defined in:
- lib/ronin/recon/scope.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defines which domains, hosts, IP addresses are considered "in scope".
Instance Attribute Summary collapse
-
#ignore ⇒ Array<Value>
readonly
private
The list of values to ignore and are not considered "in scope".
-
#values ⇒ Array<Values::Domain, Values::Host, Values::IPRange, Values::IP>
readonly
private
List of domain or IP range values which are considered "in scope".
Instance Method Summary collapse
-
#include?(value) ⇒ Boolean
private
Determines if a value is "in scope".
-
#initialize(values, ignore: []) ⇒ Scope
constructor
private
Initializes the scope.
Constructor Details
#initialize(values, ignore: []) ⇒ Scope
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 scope.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ronin/recon/scope.rb', line 60 def initialize(values, ignore: []) @values = values @ignore = ignore @host_values = [] @ip_values = [] values.each do |value| case value when Values::Wildcard, Values::Domain, Values::Host, Values::Website @host_values << value when Values::IP, Values::IPRange @ip_values << value else raise(NotImplementedError,"scope value type not supported: #{value.inspect}") end end end |
Instance Attribute Details
#ignore ⇒ Array<Value> (readonly)
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.
The list of values to ignore and are not considered "in scope".
46 47 48 |
# File 'lib/ronin/recon/scope.rb', line 46 def ignore @ignore end |
#values ⇒ Array<Values::Domain, Values::Host, Values::IPRange, Values::IP> (readonly)
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.
List of domain or IP range values which are considered "in scope".
41 42 43 |
# File 'lib/ronin/recon/scope.rb', line 41 def values @values end |
Instance Method Details
#include?(value) ⇒ Boolean
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.
Determines if a value is "in scope".
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ronin/recon/scope.rb', line 91 def include?(value) scope_values = case value when Values::Wildcard, Values::Domain, Values::Host, Values::Website, Values::URL, Values::EmailAddress @host_values when Values::IP, Values::IPRange @ip_values end return false if @ignore.any? { |ignore| ignore === value } if (scope_values && !scope_values.empty?) scope_values.any? { |scope_value| scope_value === value } else true end end |