Class: WPScan::Finders::WpVersion::UniqueFingerprinting

Inherits:
CMSScanner::Finders::Finder
  • Object
show all
Includes:
CMSScanner::Finders::Finder::Fingerprinter
Defined in:
app/finders/wp_version/unique_fingerprinting.rb

Overview

Unique Fingerprinting Version Finder

Constant Summary collapse

QUERY =
'SELECT md5_hash, path_id, version_id, ' \
'versions.number AS version,' \
'paths.value AS path ' \
'FROM fingerprints ' \
'LEFT JOIN versions ON version_id = versions.id ' \
'LEFT JOIN paths on path_id = paths.id ' \
'WHERE md5_hash IN ' \
'(SELECT md5_hash FROM fingerprints GROUP BY md5_hash HAVING COUNT(*) = 1) ' \
'ORDER BY version DESC'.freeze

Instance Method Summary collapse

Instance Method Details

#aggressive(opts = {}) ⇒ WpVersion

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/finders/wp_version/unique_fingerprinting.rb', line 19

def aggressive(opts = {})
  fingerprint(unique_fingerprints, opts) do |version_number, url, md5sum|
    hydra.abort
    progress_bar.finish

    return WPScan::WpVersion.new(
      version_number,
      found_by: 'Unique Fingerprinting (Aggressive Detection)',
      confidence: 100,
      interesting_entries: ["#{url} md5sum is #{md5sum}"]
    )
  end
  nil
end

#create_progress_bar(opts = {}) ⇒ Object



58
59
60
# File 'app/finders/wp_version/unique_fingerprinting.rb', line 58

def create_progress_bar(opts = {})
  super(opts.merge(title: 'Fingerprinting the version -'))
end

#unique_fingerprintsHash

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
}

}

Returns:

  • (Hash)

    The unique fingerprints across all versions in the DB



47
48
49
50
51
52
53
54
55
56
# File 'app/finders/wp_version/unique_fingerprinting.rb', line 47

def unique_fingerprints
  fingerprints = {}

  repository(:default).adapter.select(QUERY).each do |f|
    fingerprints[f.path] ||= {}
    fingerprints[f.path][f.md5_hash] = f.version
  end

  fingerprints
end