Class: CMSScanner::Target::Scope
- Inherits:
-
Object
- Object
- CMSScanner::Target::Scope
- Defined in:
- lib/cms_scanner/target/scope.rb
Overview
Scope Implementation
Instance Method Summary collapse
- #<<(element) ⇒ Object
-
#domains ⇒ Array<PublicSuffix::Domain>
The valid domains in scope.
-
#include?(host) ⇒ Boolean
Wether or not the host is in the scope.
-
#invalid_domains ⇒ Array<String>
The invalid domains in scope (such as IP addresses etc).
Instance Method Details
#<<(element) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/cms_scanner/target/scope.rb', line 81 def <<(element) if PublicSuffix.valid?(element, ignore_private: true) domains << PublicSuffix.parse(element, ignore_private: true) else invalid_domains << element end end |
#domains ⇒ Array<PublicSuffix::Domain>
Returns The valid domains in scope.
72 73 74 |
# File 'lib/cms_scanner/target/scope.rb', line 72 def domains @domains ||= [] end |
#include?(host) ⇒ Boolean
Returns Wether or not the host is in the scope.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cms_scanner/target/scope.rb', line 90 def include?(host) if PublicSuffix.valid?(host, ignore_private: true) domain = PublicSuffix.parse(host, ignore_private: true) domains.each { |d| return true if domain.match(d) } else invalid_domains.each { |d| return true if host == d } end false end |
#invalid_domains ⇒ Array<String>
Returns The invalid domains in scope (such as IP addresses etc).
77 78 79 |
# File 'lib/cms_scanner/target/scope.rb', line 77 def invalid_domains @invalid_domains ||= [] end |