fingerprinter 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fingerprinter/configs/scan_options.rb +1 -1
- data/lib/fingerprinter/core/detector.rb +4 -4
- data/lib/fingerprinter/core/http_client.rb +4 -3
- data/lib/fingerprinter/technologies/cms/magento.rb +12 -10
- data/lib/fingerprinter/technologies/softwares/apache_ofbiz.rb +2 -2
- data/lib/fingerprinter/technologies/softwares/nexus_repository.rb +5 -2
- data/lib/fingerprinter/utilities/kb.rb +2 -2
- data/lib/fingerprinter/utilities/parser.rb +1 -1
- data/lib/fingerprinter/utilities/urls.rb +1 -1
- data/lib/fingerprinter.rb +10 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b224d61b1b79fce378d1b8ad8ac84ac4f1de81cd37195281aee7e0051c684d6
|
4
|
+
data.tar.gz: df4ba4f706f8a5de13b778f050ee1568a5f9bdbf6cabaa7732ec5fcb745b0f39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc74aa0e8bf750f3a9d8a727a958e23d3a285491c0501763238cd5493e865bebe9590c42090b7bbf1f1cdea2ba9ac56824784eb3079b7fafeb9923deed1eae07
|
7
|
+
data.tar.gz: 7e70c7c5e3fabafd2c73dd53a1a41b1a05769044978005f0a521646b30a78ba5bc1b3a701ccd9d0b05a2cd5d6266fa35bf5075bf7f908f6babe0ff2ada89541f
|
@@ -34,7 +34,7 @@ class ScanOptions
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.user_agent
|
37
|
-
@user_agent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
37
|
+
@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'
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.timeout
|
@@ -8,14 +8,14 @@ module Fingerprinter
|
|
8
8
|
response.headers&.each do |header, value|
|
9
9
|
regex = regexes[header.downcase]
|
10
10
|
next unless regex
|
11
|
-
|
11
|
+
|
12
12
|
if value.is_a?(Array)
|
13
13
|
return true if value.any? { |v| regex.match?(v) }
|
14
|
-
|
15
|
-
return true
|
14
|
+
elsif regex.match?(value)
|
15
|
+
return true
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
false
|
20
20
|
end
|
21
21
|
|
@@ -22,9 +22,10 @@ class HttpClient
|
|
22
22
|
}
|
23
23
|
|
24
24
|
req_options[:headers].merge!({
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
'Priority' => 'u=0, i',
|
26
|
+
'Accept-Encoding' => 'gzip, deflate, br',
|
27
|
+
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8'
|
28
|
+
})
|
28
29
|
|
29
30
|
req_options[:params] = options[:params] if options[:params]
|
30
31
|
|
@@ -15,15 +15,16 @@ class Magento < Fingerprinter::Technologies
|
|
15
15
|
/Magento_PageCache/,
|
16
16
|
/Mage\.Cookies\.path/,
|
17
17
|
/data-requiremodule="(mage|Magento_)/,
|
18
|
-
/
|
18
|
+
%r{mage/cookies},
|
19
19
|
/MAGENTO_/,
|
20
20
|
/Magento Security Scan/,
|
21
|
-
/
|
21
|
+
%r{js/mage/},
|
22
22
|
/x-magento-init/
|
23
23
|
].freeze
|
24
24
|
|
25
25
|
def self.get_graphql(url)
|
26
|
-
url = File.join(Utilities::Urls.up_to_port(url),
|
26
|
+
url = File.join(Utilities::Urls.up_to_port(url),
|
27
|
+
'/graphql?query=+{customerDownloadableProducts+{+items+{+date+download_url}}+}')
|
27
28
|
return if Utilities::Kb.inspected?(self, url)
|
28
29
|
|
29
30
|
Utilities::Kb.inspected(self, url)
|
@@ -31,16 +32,17 @@ class Magento < Fingerprinter::Technologies
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def self.run(data)
|
34
|
-
detected = meta_detection(data[:doc], META_CONTENT_REGEX) ||
|
35
|
-
|
35
|
+
detected = meta_detection(data[:doc], META_CONTENT_REGEX) ||
|
36
|
+
whole_body_check(data[:response], BODY_CONTENT_REGEX)
|
36
37
|
|
37
|
-
|
38
|
-
'Magento'
|
39
|
-
else
|
38
|
+
unless detected
|
40
39
|
response = get_graphql(data[:url])
|
41
|
-
return unless response&.code == 200 && ['The current customer', 'graphql-authorization'].all?
|
40
|
+
return unless response&.code == 200 && ['The current customer', 'graphql-authorization'].all? do |pattern|
|
41
|
+
response.body.include?(pattern)
|
42
|
+
end
|
42
43
|
|
43
|
-
'Magento'
|
44
44
|
end
|
45
|
+
|
46
|
+
'Magento'
|
45
47
|
end
|
46
48
|
end
|
@@ -28,13 +28,13 @@ class ApacheOfbiz < Fingerprinter::Technologies
|
|
28
28
|
response = get_xmlrpc(data[:url])
|
29
29
|
return unless response&.code == 200
|
30
30
|
|
31
|
-
doc = Utilities::Parser.doc(response.body)
|
31
|
+
data[:doc] = Utilities::Parser.doc(response.body)
|
32
32
|
end
|
33
33
|
|
34
34
|
return unless response_headers_check(response, HEADERS_REGEX) ||
|
35
35
|
meta_detection(data[:doc], META_CONTENT_REGEX) ||
|
36
36
|
whole_body_check(response, BODY_CONTENT_REGEX)
|
37
37
|
|
38
|
-
'Apache
|
38
|
+
'Apache OFBiz'
|
39
39
|
end
|
40
40
|
end
|
@@ -15,13 +15,16 @@ class NexusRepository < Fingerprinter::Technologies
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.run(data)
|
18
|
-
detected = title_detection(data[:doc],
|
18
|
+
detected = title_detection(data[:doc],
|
19
|
+
'Sonatype Nexus Repository') || meta_detection(data[:doc], META_CONTENT_REGEX,
|
20
|
+
'description')
|
19
21
|
unless detected
|
20
22
|
response = check_path(data[:url])
|
21
23
|
return unless response&.code == 200
|
22
24
|
|
23
25
|
doc = Utilities::Parser.doc(response.body)
|
24
|
-
detected = title_detection(doc,
|
26
|
+
detected = title_detection(doc,
|
27
|
+
'Sonatype Nexus Repository') || meta_detection(doc, META_CONTENT_REGEX, 'description')
|
25
28
|
end
|
26
29
|
return unless detected
|
27
30
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class Utilities
|
4
4
|
# Files : Utilities related to files
|
5
|
-
class Kb
|
5
|
+
class Kb
|
6
6
|
def self.coverage_id(plugin, url)
|
7
7
|
"#{plugin}:#{url}"
|
8
8
|
end
|
@@ -15,4 +15,4 @@ class Utilities
|
|
15
15
|
Fingerprinter::Technologies.kb[:inspected].include?(coverage_id(plugin, url))
|
16
16
|
end
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
data/lib/fingerprinter.rb
CHANGED
@@ -44,7 +44,7 @@ module Fingerprinter
|
|
44
44
|
doc = Utilities::Parser.doc(response.body)
|
45
45
|
|
46
46
|
results[url] = Concurrent::Array.new
|
47
|
-
data = { response
|
47
|
+
data = { response: response, doc: doc, url: url }
|
48
48
|
Technologies.subclasses.each { |technology| results[url] << technology.run(data) }
|
49
49
|
end
|
50
50
|
end
|
@@ -56,11 +56,16 @@ module Fingerprinter
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def get_response(url)
|
59
|
-
response =
|
60
|
-
|
61
|
-
|
59
|
+
response = nil
|
60
|
+
3.times do
|
61
|
+
response = Fingerprinter.http_client.get(url, { follow_location: true })[url]
|
62
|
+
break if response&.code != 0 && !response.return_message.include?('Stream error')
|
62
63
|
|
63
|
-
|
64
|
+
sleep(1)
|
65
|
+
end
|
66
|
+
return response if response&.code&.zero? || same_scope?(url, response)
|
67
|
+
|
68
|
+
response.redirections.first
|
64
69
|
end
|
65
70
|
|
66
71
|
def same_scope?(url, response)
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fingerprinter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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-
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: concurrent-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: typhoeus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|