Sha256: 6d52d0d2502e769da0c723caa316a055cfda4a062f8f294e0f3c2ff4173a96f0

Contents?: true

Size: 1.29 KB

Versions: 50

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module WPScan
  module DB
    # Fingerprints class
    class Fingerprints
      # @param [ Hash ] data
      #
      # @return [ Hash ] the unique fingerprints in the data argument given
      # 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
      #   }
      # }
      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

      # @return [ String ]
      def self.wp_fingerprints_path
        @wp_fingerprints_path ||= DB_DIR.join('wp_fingerprints.json').to_s
      end

      # @return [ Hash ]
      def self.wp_fingerprints
        @wp_fingerprints ||= read_json_file(wp_fingerprints_path)
      end

      # @return [ Hash ]
      def self.wp_unique_fingerprints
        @wp_unique_fingerprints ||= unique_fingerprints(wp_fingerprints)
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
wpscan-3.8.28 lib/wpscan/db/fingerprints.rb
wpscan-3.8.27 lib/wpscan/db/fingerprints.rb
wpscan-3.8.26 lib/wpscan/db/fingerprints.rb
wpscan-3.8.25 lib/wpscan/db/fingerprints.rb
wpscan-3.8.24 lib/wpscan/db/fingerprints.rb
wpscan-3.8.22 lib/wpscan/db/fingerprints.rb
wpscan-3.8.21 lib/wpscan/db/fingerprints.rb
wpscan-3.8.20 lib/wpscan/db/fingerprints.rb
wpscan-3.8.19 lib/wpscan/db/fingerprints.rb
wpscan-3.8.18 lib/wpscan/db/fingerprints.rb
wpscan-3.8.17 lib/wpscan/db/fingerprints.rb
wpscan-3.8.16 lib/wpscan/db/fingerprints.rb
wpscan-3.8.15 lib/wpscan/db/fingerprints.rb
wpscan-3.8.14 lib/wpscan/db/fingerprints.rb
wpscan-3.8.13 lib/wpscan/db/fingerprints.rb
wpscan-3.8.12 lib/wpscan/db/fingerprints.rb
wpscan-3.8.11 lib/wpscan/db/fingerprints.rb
wpscan-3.8.10 lib/wpscan/db/fingerprints.rb
wpscan-3.8.9 lib/wpscan/db/fingerprints.rb
wpscan-3.8.8 lib/wpscan/db/fingerprints.rb