Class: X509Sleuth::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/x509_sleuth/scanner.rb,
lib/x509_sleuth/scanner/target.rb

Defined Under Namespace

Classes: Target

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Scanner

Returns a new instance of Scanner.



9
10
11
12
13
14
15
16
# File 'lib/x509_sleuth/scanner.rb', line 9

def initialize(options = {})
  options = {
    concurrency: 5
  }.merge(options)

  @concurrency  = options[:concurrency]
  @targets      = []
end

Instance Attribute Details

#clientsObject (readonly)

Returns the value of attribute clients.



7
8
9
# File 'lib/x509_sleuth/scanner.rb', line 7

def clients
  @clients
end

#concurrencyObject

Returns the value of attribute concurrency.



6
7
8
# File 'lib/x509_sleuth/scanner.rb', line 6

def concurrency
  @concurrency
end

#targetsObject (readonly)

Returns the value of attribute targets.



7
8
9
# File 'lib/x509_sleuth/scanner.rb', line 7

def targets
  @targets
end

Instance Method Details

#add_target(target_string) ⇒ Object



18
19
20
# File 'lib/x509_sleuth/scanner.rb', line 18

def add_target(target_string)
  @targets << X509Sleuth::Scanner::Target.new(target_string)
end

#runObject



31
32
33
34
35
# File 'lib/x509_sleuth/scanner.rb', line 31

def run
  Parallel.each(clients, in_threads: concurrency) do |client|
    client.connect
  end
end