fingerprinter 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c157498e26152c04f85a984944773ef0cff4992fb0281b72506b74d6b2afdad0
4
- data.tar.gz: e5ee489390ae069d2953f99ea90a25030f697f41c832cfb3f156e699c4bbff51
3
+ metadata.gz: 0b615b35520844d41a238e14b38117a52623f8e1445a2bb1bac20f93dfe31eb2
4
+ data.tar.gz: 8299df5625b0c22e690cdaede06392551473674be475fdb9e9093178af938446
5
5
  SHA512:
6
- metadata.gz: 80f2e6a58d7978d2d966da1e89b2b0fb49f200c13db2ba46a2c6e43a9cf5137160620e5aa728c64ddedd7f3314f617637e4999806c67cb4b604f110c4f49a8c0
7
- data.tar.gz: 9c407c2c63a0791ea99e4b5c3c12c8392f9a3c9e0d44ce8256b7c1301a2bb12ddab04f847a64202dd1b3bee56efd17e4fd29a80ee3ba27795c8064580402f9c6
6
+ metadata.gz: 77df6c3fde451e04a37b751c5da6e49cc7cbd9fac005e8edeaf79322380df74bbf3883422b880013dc1e3aa77a2719c95af2e8382d24d90288ac9f3f2a1ba7e0
7
+ data.tar.gz: b3637abef00af676d8308d4157411b3238fdd3a2af57e2c46c38029cb83d2d943f361631d399841942eeda1da78246fb4a27a6550610e0bcf4743fca3acfb7b7
@@ -3,7 +3,7 @@
3
3
  # This class builds and maintains the list of options provided for the scan to make it available
4
4
  # when needed
5
5
  class ScanOptions
6
- def self.build(options)
6
+ def self.build(options)
7
7
  @proxy = options[:proxy]
8
8
  @user_agent = options[:ua]
9
9
  @timeout = options[:timeout]
@@ -42,7 +42,7 @@ class ScanOptions
42
42
  end
43
43
 
44
44
  def self.http_concurrency
45
- @concurrency || 10
45
+ @concurrency || 20
46
46
  end
47
47
 
48
48
  def self.silent?
@@ -8,7 +8,6 @@ require 'typhoeus'
8
8
  class HttpClient
9
9
  def initialize
10
10
  Typhoeus::Config.user_agent = ScanOptions.user_agent
11
- @hydra = Typhoeus::Hydra.new(max_concurrency: ScanOptions.http_concurrency)
12
11
  end
13
12
 
14
13
  def request_options(method, options, body = nil)
@@ -35,36 +34,12 @@ class HttpClient
35
34
  req_options
36
35
  end
37
36
 
38
- def get(urls, options = {})
37
+ def get(url, options = {})
39
38
  responses = {}
40
39
 
41
- urls = [urls] if urls.is_a?(String)
42
- urls.each do |url|
43
- http_request = Typhoeus::Request.new(url, request_options(:get, options))
44
-
45
- http_request.on_complete { |response| responses[url] = response }
46
-
47
- @hydra.queue(http_request)
48
- end
49
-
50
- @hydra.run
51
-
52
- responses
53
- end
54
-
55
- def post(urls, body, options = {})
56
- responses = {}
57
-
58
- urls = [urls] if urls.is_a?(String)
59
- urls.each do |url|
60
- http_request = Typhoeus::Request.new(url, request_options(:post, options, body))
61
-
62
- http_request.on_complete { |response| responses[url] = response }
63
-
64
- @hydra.queue(http_request)
65
- end
66
-
67
- @hydra.run
40
+ http_request = Typhoeus::Request.new(url, request_options(:get, options))
41
+ http_request.on_complete { |response| responses[url] = response }
42
+ http_request.run
68
43
 
69
44
  responses
70
45
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Progress Kemp Load Master Detection
4
+ class ProgressKempLoadMaster < Fingerprinter::Technologies
5
+ BODY_CONTENT_REGEX = [
6
+ /LoadMaster/
7
+ ].freeze
8
+
9
+ def self.run(data)
10
+ return unless title_detection(data[:doc], 'Configuration') &&
11
+ whole_body_check(data[:response], BODY_CONTENT_REGEX)
12
+
13
+ 'Progress Kemp Load Master'
14
+ end
15
+ end
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.11
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-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -68,6 +68,7 @@ files:
68
68
  - lib/fingerprinter/technologies/softwares/apache_ofbiz.rb
69
69
  - lib/fingerprinter/technologies/softwares/f5_next_central_manager.rb
70
70
  - lib/fingerprinter/technologies/softwares/nexus_repository.rb
71
+ - lib/fingerprinter/technologies/softwares/progress_kemp_load_master.rb
71
72
  - lib/fingerprinter/technologies/softwares/servicenow.rb
72
73
  - lib/fingerprinter/technologies/softwares/tinyproxy.rb
73
74
  - lib/fingerprinter/utilities/kb.rb