Class: NexusRepository

Inherits:
Fingerprinter::Technologies show all
Defined in:
lib/fingerprinter/technologies/softwares/nexus_repository.rb

Overview

Nexus Repository Detection

Constant Summary collapse

META_CONTENT_REGEX =
[
  'Nexus Repository'
].freeze

Instance Attribute Summary

Attributes inherited from Fingerprinter::Technologies

#http_client, #results

Class Method Summary collapse

Methods inherited from Fingerprinter::Technologies

#initialize, kb, meta_detection, response_headers_check, #run, title_detection, whole_body_check

Constructor Details

This class inherits a constructor from Fingerprinter::Technologies

Class Method Details

.check_path(url) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/fingerprinter/technologies/softwares/nexus_repository.rb', line 9

def self.check_path(url)
  url = File.join(Utilities::Urls.up_to_port(url), '/nexus/')
  return if Utilities::Kb.inspected?(self, url)

  Utilities::Kb.inspected(self, url)
  Fingerprinter.http_client.get(url, { follow_location: true })[url]
end

.run(data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fingerprinter/technologies/softwares/nexus_repository.rb', line 17

def self.run(data)
  detected = title_detection(data[:doc],
                             'Sonatype Nexus Repository') || meta_detection(data[:doc], META_CONTENT_REGEX,
                                                                            'description')
  unless detected
    response = check_path(data[:url])
    return unless response&.code == 200

    doc = Utilities::Parser.doc(response.body)
    detected = title_detection(doc,
                               'Sonatype Nexus Repository') || meta_detection(doc, META_CONTENT_REGEX, 'description')
  end
  return unless detected

  'Nexus Repository'
end