Sha256: 940d906ba67671ad1eb5f5fd031d839f48156c69ccffadefc019e6b15abbe11b

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

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_unique_fingerprints_path ||= File.join(DB_DIR, 'wp_fingerprints.json')
      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

6 entries across 6 versions & 1 rubygems

Version Path
wpscan-3.2.1 lib/wpscan/db/fingerprints.rb
wpscan-3.2.0 lib/wpscan/db/fingerprints.rb
wpscan-3.1.0 lib/wpscan/db/fingerprints.rb
wpscan-3.0.8 lib/wpscan/db/fingerprints.rb
wpscan-3.0.7 lib/wpscan/db/fingerprints.rb
wpscan-3.0.6 lib/wpscan/db/fingerprints.rb