fingerprinter 0.1.8 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fingerprinter.rb +21 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 701ce40db725878091d58e64e82bdf02b54043b81ef417c192288354ceee73d0
4
- data.tar.gz: 0c09713a4d7a023e426b178fc0b02b832816f33e04188a584100c7dc412daf75
3
+ metadata.gz: 74fd693d01fe16bf30ca09e3369223b409302c0e940fcfe581067dd2bc0b4814
4
+ data.tar.gz: 5b7f9bb28cf3435e0ef26af689748912c8b6fe876901eb56d380d1f43eeffde2
5
5
  SHA512:
6
- metadata.gz: 0d1583979e056fda56d4aed03db3a6c6c1ae6028f65cdb39a7e18222ba308225ff58eb910b1e2b7226ab3c7495bf585faefb9b930fbd39e9faf3ce130a10725a
7
- data.tar.gz: 8fc0c2fe89d8ac30bf51b9b38dbdba4a0c0ab2b161e604ce17e60bda2d565d51851c5a92ae3bd82ccc2ae8b620bc4603c2332b7b3c49024623b9da8fac20d56b
6
+ metadata.gz: 9099f2a57dc3731493bb524c71931fb58e853b50bf141a1de2f58e1621b7c7cc3dc3c97791e98256ebd11da78e69575c2a375b0953bd484c542c74814dfb8996
7
+ data.tar.gz: 2d7e440fb17af756dd80e2ead211f312dda8df9ea0cfb7ba2357371f226b6f1feb5531be67605fcde7655f58096a4daa034bd4ca973ea71c2a1ffe20bc96992e
data/lib/fingerprinter.rb CHANGED
@@ -8,7 +8,8 @@ module Fingerprinter
8
8
  Dir[File.join(__dir__, 'fingerprinter', 'core/*.rb')].sort.each { |file| require file }
9
9
  Dir[File.join(__dir__, 'fingerprinter', 'utilities/*.rb')].sort.each { |file| require file }
10
10
 
11
- EXCLUSIONS = %w[paas.diod.orange.com].freeze
11
+ EXCLUSIONS = %w[paas.diod.orange.com prod.pc0.dbs.com].freeze
12
+ SC_EXCLUSIONS = %i[0 418].freeze
12
13
  WILDCARDS = [
13
14
  ['Application is not available', 'The application is currently not serving requests at this endpoint']
14
15
  ].freeze
@@ -36,27 +37,33 @@ module Fingerprinter
36
37
  end
37
38
 
38
39
  def run(urls)
40
+ pool = Concurrent::FixedThreadPool.new(ScanOptions.http_concurrency)
39
41
  urls.each do |url|
40
42
  next if EXCLUSIONS.any? { |exclusion| url.match?(exclusion) }
41
43
 
42
- response = get_response(url)
43
- next unless response
44
- next if wildcard?(response)
44
+ pool.post do
45
+ response = get_response(url)
46
+ next unless response
47
+ next if wildcard?(response)
45
48
 
46
- url = effective_url(response, url)
47
-
48
- responses = response.redirections
49
- responses << response
49
+ url = effective_url(response, url)
50
+
51
+ responses = response.redirections
52
+ responses << response
50
53
 
51
- responses.each do |response|
52
- doc = Utilities::Parser.doc(response.body)
54
+ responses.each do |response|
55
+ doc = Utilities::Parser.doc(response.body)
53
56
 
54
- results[url] = Concurrent::Array.new
55
- data = { response:, doc:, url: }
56
- Technologies.subclasses.each { |technology| results[url] << technology.run(data) }
57
+ results[url] = Concurrent::Array.new
58
+ data = { response:, doc:, url: }
59
+ Technologies.subclasses.each { |technology| results[url] << technology.run(data) }
60
+ end
57
61
  end
58
62
  end
59
63
 
64
+ pool.shutdown
65
+ pool.wait_for_termination
66
+
60
67
  results.transform_values! { |v| v.compact.uniq }
61
68
  results
62
69
  end
@@ -85,7 +92,7 @@ module Fingerprinter
85
92
  url = normalize_url(url)
86
93
  return get_response(url)
87
94
  end
88
- return if response&.code == 0
95
+ return if SC_EXCLUSIONS.include?(response&.code)
89
96
  return response if response.redirections.empty? || same_scope?(url, response)
90
97
 
91
98
  response.redirections.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingerprinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua MARTINELLE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby