forked from curl/curl-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistpem.pl
executable file
·36 lines (33 loc) · 860 Bytes
/
listpem.pl
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
#!/usr/bin/perl
opendir(my $dh, ".") || die "can't opendir: $!";
my @pems = grep { /^cacert-.*pem$/ } readdir($dh);
closedir $dh;
sub countcerts {
my ($f)=@_;
open(F, "<$f");
my $cert;
while(<F>) {
if($_ =~ /^-----BEGIN/) {
$cert++;
}
}
return $cert;
}
print "<table><tr><th>Date</th><th>Certificates</th><tr>\n";
my $l = 0;
foreach my $p (reverse sort @pems) {
if($p =~ /cacert-(.*).pem$/) {
my $n = countcerts($p);
my $date = $1;
printf "<tr %s><td><a href=\"/ca/$p\">%s</a>%s</td> <td align=center>%d</td></tr>\n",
$l&1?"class=\"odd\"":"",
$date,
(-e "$p.sha256" ? " (<a href=\"/ca/$p.sha256\">sha256</a>)" : ""),
$n;
if(++$l >= 10) {
# only show 10
last;
}
}
}
print "</table>\n";