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

Commit

Permalink
Fix duplicate fingerprint bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Claudius committed Mar 24, 2017
1 parent df78ace commit 8a17985
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 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,11 @@ 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 8a17985

Please sign in to comment.