From 9a31c07e0d39e97ee4b39996d609c12b9c46f078 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 18 May 2008 14:59:28 +0200 Subject: [PATCH] Add key information to the weak key message --- dowkd.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dowkd.in b/dowkd.in index a1b608c..374ab13 100644 --- a/dowkd.in +++ b/dowkd.in @@ -126,12 +126,13 @@ sub print_stats () { print STDERR "summary: keys found: $keys_found, weak keys: $keys_vulnerable\n"; } -sub check_hash ($$) { - my ($name, $hash) = @_; +sub check_hash ($$;$) { + my ($name, $hash, $descr) = @_; ++$keys_found; if (exists $db{$hash}) { ++$keys_vulnerable; - print "$name: weak key\n"; + $descr = $descr ? " ($descr)" : ''; + print "$name: weak key$descr\n"; } } @@ -149,7 +150,7 @@ sub ssh_fprint_check ($$$) { if ($length == 1024 || $length == 2048) { $hash =~ y/://d; $hash =~ s/(..)/chr(hex($1))/ge; - check_hash $name, $hash; + check_hash $name, $hash, "OpenSSH/$length"; } else { warn "$name: warning: no suitable blacklist\n"; } @@ -269,7 +270,7 @@ sub from_openvpn_key ($) { if ($line =~ /^([0-9a-f]{32})/) { $line = $1; $line =~ s/(..)/chr(hex($1))/ge; - check_hash "$name:$.", $line; + check_hash "$name:$.", $line, "OpenVPN"; return 1; } else { warn "$name:$.: warning: illegal OpenVPN file format\n"; -- 2.11.4.GIT