Class: WPScan::DB::Fingerprints

Inherits:
Object
  • Object
show all
Defined in:
lib/wpscan/db/fingerprints.rb

Overview

Fingerprints class

Class Method Summary collapse

Class Method Details

.unique_fingerprints(data) ⇒ Hash

Format returned: {

file_path_1: {
  md5_hash_1: version_1,
  md5_hash_2: version_2
},
file_path_2: {
  md5_hash_3: version_1,
  md5_hash_4: version_3
}

}

Parameters:

  • data (Hash)

Returns:

  • (Hash)

    the unique fingerprints in the data argument given



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wpscan/db/fingerprints.rb', line 21

def self.unique_fingerprints(data)
  unique_fingerprints = {}

  data.each do |file_path, fingerprints|
    fingerprints.each do |md5sum, versions|
      next unless versions.size == 1

      unique_fingerprints[file_path] ||= {}
      unique_fingerprints[file_path][md5sum] = versions.first
    end
  end

  unique_fingerprints
end

.wp_fingerprintsHash

Returns:

  • (Hash)


42
43
44
# File 'lib/wpscan/db/fingerprints.rb', line 42

def self.wp_fingerprints
  @wp_fingerprints ||= read_json_file(wp_fingerprints_path)
end

.wp_fingerprints_pathString

Returns:

  • (String)


37
38
39
# File 'lib/wpscan/db/fingerprints.rb', line 37

def self.wp_fingerprints_path
  @wp_fingerprints_path ||= DB_DIR.join('wp_fingerprints.json').to_s
end

.wp_unique_fingerprintsHash

Returns:

  • (Hash)


47
48
49
# File 'lib/wpscan/db/fingerprints.rb', line 47

def self.wp_unique_fingerprints
  @wp_unique_fingerprints ||= unique_fingerprints(wp_fingerprints)
end