Class: RogueOne::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/rogue_one/detector.rb

Constant Summary collapse

GOOGLE_PUBLIC_DNS =
"8.8.8.8"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target:, custom_list: nil, default_list: "alexa", record_type: "A", threshold: nil, verbose: false) ⇒ Detector

Returns a new instance of Detector.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rogue_one/detector.rb', line 18

def initialize(
  target:,
  custom_list: nil,
  default_list: "alexa",
  record_type: "A",
  threshold: nil,
  verbose: false
)
  @target = target

  @custom_list = custom_list
  @default_list = default_list
  @record_type = record_type.upcase.to_sym
  @threshold = threshold
  @verbose = verbose

  @max_concurrency = Etc.nprocessors * 2
  @memo = {}
  @verbose_memo = nil
end

Instance Attribute Details

#custom_listObject (readonly)

Returns the value of attribute custom_list.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def custom_list
  @custom_list
end

#default_listObject (readonly)

Returns the value of attribute default_list.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def default_list
  @default_list
end

#max_concurrencyObject (readonly)

Returns the value of attribute max_concurrency.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def max_concurrency
  @max_concurrency
end

#record_typeObject (readonly)

Returns the value of attribute record_type.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def record_type
  @record_type
end

#targetObject (readonly)

Returns the value of attribute target.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def target
  @target
end

#verboseObject (readonly)

Returns the value of attribute verbose.



14
15
16
# File 'lib/rogue_one/detector.rb', line 14

def verbose
  @verbose
end

Instance Method Details

#reportObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/rogue_one/detector.rb', line 39

def report
  inspect

  {
    verdict: verdict,
    landing_pages: landing_pages,
    results: results,
    meta: meta
  }.compact
end