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
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
51 52 53 54 55 56 57 |
# File 'lib/cms_scanner/target/scope.rb', line 51 def <<(element) if PublicSuffix.valid?(element) domains << PublicSuffix.parse(element) else invalid_domains << element end end |
#domains ⇒ Array<PublicSuffix::Domain ] The valid domains in scope
Returns Array<PublicSuffix::Domain ] The valid domains in scope.
42 43 44 |
# File 'lib/cms_scanner/target/scope.rb', line 42 def domains @domains ||= [] end |
#include?(host) ⇒ Boolean
Returns Wether or not the host is in the scope.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cms_scanner/target/scope.rb', line 60 def include?(host) if PublicSuffix.valid?(host) domain = PublicSuffix.parse(host) 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).
47 48 49 |
# File 'lib/cms_scanner/target/scope.rb', line 47 def invalid_domains @invalid_domains ||= [] end |