]>
git.sthu.org Git - pgp-tools.git/blob - keyanalyze/scripts/top50.pl
2 # this short script is for making the HTML for the top50 report monthly
3 # Copyright (c)2001 M. Drew Streib
4 # This code is released under the GPL version 2 or later.
6 # 2004-09-14: modifications by Christoph Berg <cb@df7cb.de>:
7 # * use perl to read top50comments.txt
8 # * use gpg --list-key instead of wget
9 # * use strict & warnings
11 # 2008-07-18: modifications by Christoph Berg <cb@df7cb.de>:
12 # * directly read msd.txt instead of a -sorted variant
17 #my $keyserver = "http://pks.gpg.cz:11371/pks/lookup?op=vindex&fingerprint=on&search=0x";
18 #my $keyserver = "http://keyserver.noreply.org/pks/lookup?op=index&fingerprint=on&search=0x";
19 my $keyserver = "http://subkeys.pgp.net:11371/pks/lookup?op=index&fingerprint=on&search=0x";
21 getopts
('c:k:n:', \
%options);
22 my $comments = $options{c
} || "top50comments.txt";
23 my $keyring = $options{k
} ?
"--no-default-keyring --keyring=$options{k}" : "";
24 my $top = $options{n
} || 50;
27 if (open F
, $comments) {
29 die "$comments.$.: syntax error" unless /([\dA-F]+)\b ?(.*)/;
36 while (my $line = <>) {
37 $line =~ /^\w+\s+(\w+)\s+([\d\.]+)/ or die "cannot parse line $.: $line";
42 print "<tr><th>#</th><th>Id</th><th></th><th>Name</th><th>MSD</th></tr>\n";
46 foreach my $key (sort { $msd{$a} <=> $msd{$b} } keys %msd) {
48 if($oldmsd != $msd{$key}) {
51 last if $rank and $rank > $top;
54 open G
, "gpg --list-key --fixed-list-mode --with-colon --trust-model always $keyring $key |" or die "gpg: $!";
56 #uid:u::::1082202576::1DC0BEA2AC64671CC902D50B8121F6E4E6336E15::Christoph Berg <cb@df7cb.de>:
57 next unless /^uid:[-qmfue]::::\d*::[\dA-F]*::(.+):$/;
61 $name =~ s/\@/@/g;
65 my $comment = $comment{$key} || "";
66 $key =~ /^([\dA-F]{2})/;
68 #print "<TR><TD align=\"right\">$rank</TD><TD><a href=\"$prefix/$key.html\">$key</a> <small><A href=\"$keyserver$key\">keyserver</A></small></TD><TD>$name</TD><TD><I>$comment</I></TD><TD align=\"right\">$msd</TD></TR>\n";
69 print "<TR><TD align=\"right\">$rank</TD><TD><a href=\"$key.html\">$key</a></TD><TD><small><A href=\"$keyserver$key\">keyserver</A></small></TD><TD>$name <I>$comment</I></TD><TD align=\"right\">$msd{$key}</TD></TR>\n";