Class: ScanOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/fingerprinter/configs/scan_options.rb

Overview

This class builds and maintains the list of options provided for the scan to make it available when needed

Class Method Summary collapse

Class Method Details

.build(options) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fingerprinter/configs/scan_options.rb', line 6

def self.build(options) 
  @proxy = options[:proxy]
  @user_agent = options[:ua]
  @timeout = options[:timeout]
  @concurrency = options[:concurrency]
  @silent = options[:silent]
end

.http_concurrencyObject



44
45
46
# File 'lib/fingerprinter/configs/scan_options.rb', line 44

def self.http_concurrency
  @concurrency || 20
end

.proxy?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/fingerprinter/configs/scan_options.rb', line 14

def self.proxy?
  !!@proxy
end

.proxy_hostObject



18
19
20
21
22
23
# File 'lib/fingerprinter/configs/scan_options.rb', line 18

def self.proxy_host
  uri = URI(@proxy)
  return '' unless uri

  uri.host.to_s
end

.proxy_portObject



29
30
31
32
33
34
# File 'lib/fingerprinter/configs/scan_options.rb', line 29

def self.proxy_port
  uri = URI(@proxy)
  return nil unless uri

  uri.port.to_s
end

.proxy_urlObject



25
26
27
# File 'lib/fingerprinter/configs/scan_options.rb', line 25

def self.proxy_url
  @proxy
end

.silent?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/fingerprinter/configs/scan_options.rb', line 48

def self.silent?
  !!@silent
end

.timeoutObject



40
41
42
# File 'lib/fingerprinter/configs/scan_options.rb', line 40

def self.timeout
  @timeout ? @timeout.to_i : 10
end

.user_agentObject



36
37
38
# File 'lib/fingerprinter/configs/scan_options.rb', line 36

def self.user_agent
  @user_agent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
end