1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/perl
use strict;
use warnings;
use DB_File;
my %ident;
if ($#ARGV != 0) {
print "Must supply key id.\n";
exit 1;
}
open KEYIDS, "<keyids" or die "Can't open keyids file: $!";
while (<KEYIDS>) {
chomp;
/^0x([^ ]*) (.*)/;
$ident{$1} = $2;
}
close KEYIDS;
$ARGV[0] =~ s/0x//;
my $keyid = $ARGV[0];
my $user;
if (! defined($ident{$ARGV[0]})) {
$user = "UNKNOWN (DM?)";
} else {
$user = $ident{$ARGV[0]};
}
my ($uids, $subs, $sigs) = (0, 0, 0);
while (<STDIN>) {
if (/new subkeys: (\d+)$/) {
$subs = $1;
} elsif (/new user IDs: (\d+)$/) {
$uids = $1;
} elsif (/new signatures: (\d+)$/) {
$sigs = $1;
}
}
print "0x$keyid $user";
print " uid:$uids" if ($uids > 0);
print " sub:$subs" if ($subs > 0);
print " sig:$sigs" if ($sigs > 0);
print "\n";
|