fingerprinter 0.1.9 → 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 +20 -13
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c157498e26152c04f85a984944773ef0cff4992fb0281b72506b74d6b2afdad0
4
- data.tar.gz: e5ee489390ae069d2953f99ea90a25030f697f41c832cfb3f156e699c4bbff51
3
+ metadata.gz: 74fd693d01fe16bf30ca09e3369223b409302c0e940fcfe581067dd2bc0b4814
4
+ data.tar.gz: 5b7f9bb28cf3435e0ef26af689748912c8b6fe876901eb56d380d1f43eeffde2
5
5
  SHA512:
6
- metadata.gz: 80f2e6a58d7978d2d966da1e89b2b0fb49f200c13db2ba46a2c6e43a9cf5137160620e5aa728c64ddedd7f3314f617637e4999806c67cb4b604f110c4f49a8c0
7
- data.tar.gz: 9c407c2c63a0791ea99e4b5c3c12c8392f9a3c9e0d44ce8256b7c1301a2bb12ddab04f847a64202dd1b3bee56efd17e4fd29a80ee3ba27795c8064580402f9c6
6
+ metadata.gz: 9099f2a57dc3731493bb524c71931fb58e853b50bf141a1de2f58e1621b7c7cc3dc3c97791e98256ebd11da78e69575c2a375b0953bd484c542c74814dfb8996
7
+ data.tar.gz: 2d7e440fb17af756dd80e2ead211f312dda8df9ea0cfb7ba2357371f226b6f1feb5531be67605fcde7655f58096a4daa034bd4ca973ea71c2a1ffe20bc96992e
data/lib/fingerprinter.rb CHANGED
@@ -9,6 +9,7 @@ module Fingerprinter
9
9
  Dir[File.join(__dir__, 'fingerprinter', 'utilities/*.rb')].sort.each { |file| require file }
10
10
 
11
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.9
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