Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #352 from mozilla/fix_fingerprint_bug
Browse files Browse the repository at this point in the history
Fix duplicate fingerprint bug
  • Loading branch information
Jonathan Claudius authored Mar 24, 2017
2 parents 105107b + b5b9cf5 commit 1c719e3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ssh_scan/scan_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ def scan(opts)
fingerprint_db.clear_fingerprints(result[:ip])
if result['fingerprints']
result['fingerprints'].values.each do |host_key_algo|
host_key_algo.values.each do |fingerprint|
fingerprint_db.add_fingerprint(fingerprint, result[:ip])
host_key_algo.each do |fingerprint|
key, value = fingerprint
next if key == "known_bad"
fingerprint_db.add_fingerprint(value, result[:ip])
end
end
end
Expand All @@ -163,8 +165,10 @@ def scan(opts)
ip = result[:ip]
result['duplicate_host_key_ips'] = []
result['fingerprints'].values.each do |host_key_algo|
host_key_algo.values.each do |fingerprint|
fingerprint_db.find_fingerprints(fingerprint).each do |other_ip|
host_key_algo.each do |fingerprint|
key, value = fingerprint
next if key == "known_bad"
fingerprint_db.find_fingerprints(value).each do |other_ip|
next if ip == other_ip
result['duplicate_host_key_ips'] << other_ip
end
Expand Down

0 comments on commit 1c719e3

Please sign in to comment.