blob: 050bdb8cd07c89f0005c974670988ff7fee3638d (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/bin/perl
use HTML::Template;
undef $/;
my $VAR1;
my $code = <>;
my $tls_data = eval $code;
my $data;
for my $remailer (sort {$a->{'nick'} cmp $b->{'nick'}} @$tls_data) {
for my $mx (@{$remailer->{'mx'}}) {
for my $key (keys %{$mx->{'res'}->{'smtp'}}) {
$mx->{$key} = $mx->{'res'}->{'smtp'}->{$key};
};
for my $type (qw{submission smtps 2525}) {
#for my $type (qw{submission smtps 2525 25000}) {
#for my $type (qw{submission smtps 2525 22222}) {
$mx->{$type} = $mx->{'res'}->{$type}->{'result'};
};
$mx->{'ssl'} = $mx->{'res'}->{'smtps'}->{'tls'};
if ($mx->{'tls'}) {
my $basename = $mx->{'mx'};
$basename =~ s/[^A-Za-z0-9\.-]//g;
$basename =~ s/\.\././;
$basename = 'cert-' . $basename . '.txt';
open (F, '>'.$basename) or die ("Cannot open $basename: $!\n");
print F $mx->{'tls'};
close (F);
$mx->{'cert_url'} = $basename;
($mx->{'tls-cipher'}) = $mx->{'tls'} =~ /Cipher is (.*)$/m;
};
if ($mx->{'ssl'}) {
my $basename = $mx->{'mx'};
$basename =~ s/[^A-Za-z0-9\.-]//g;
$basename =~ s/\.\././;
$basename = 'cert-' . $basename . '.ssl.txt';
open (F, '>'.$basename) or die ("Cannot open $basename: $!\n");
print F $mx->{'ssl'};
close (F);
$mx->{'ssl_url'} = $basename;
($mx->{'ssl-cipher'}) = $mx->{'ssl'} =~ /Cipher is (.*)$/m;
};
$mx->{'result-defined'} = defined $mx->{'result'};
};
push @{$data->{'remailer'}}, $remailer;
};
$data->{'now'} = gmtime();
#require Data::Dumper;
#print Data::Dumper->Dump([$tls_data]);
my $template = HTML::Template->new(filename => 'template.tmpl', die_on_bad_params => 0);
$template->param( $data );
my $out = $template->output;
print $out;
|