line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# <@LICENSE> |
2
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more |
3
|
|
|
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with |
4
|
|
|
|
|
|
|
# this work for additional information regarding copyright ownership. |
5
|
|
|
|
|
|
|
# The ASF licenses this file to you under the Apache License, Version 2.0 |
6
|
|
|
|
|
|
|
# (the "License"); you may not use this file except in compliance with |
7
|
|
|
|
|
|
|
# the License. You may obtain a copy of the License at: |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
12
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
13
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
15
|
|
|
|
|
|
|
# limitations under the License. |
16
|
|
|
|
|
|
|
# </@LICENSE> |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Mail::SpamAssassin::Plugin; |
20
|
22
|
|
|
22
|
|
152
|
use Mail::SpamAssassin::Logger; |
|
22
|
|
|
|
|
46
|
|
|
22
|
|
|
|
|
572
|
|
21
|
22
|
|
|
22
|
|
104
|
|
|
22
|
|
|
|
|
42
|
|
|
22
|
|
|
|
|
1118
|
|
22
|
|
|
|
|
|
|
use strict; |
23
|
22
|
|
|
22
|
|
118
|
use warnings; |
|
22
|
|
|
|
|
40
|
|
|
22
|
|
|
|
|
385
|
|
24
|
22
|
|
|
22
|
|
98
|
# use bytes; |
|
22
|
|
|
|
|
42
|
|
|
22
|
|
|
|
|
634
|
|
25
|
|
|
|
|
|
|
use re 'taint'; |
26
|
22
|
|
|
22
|
|
111
|
|
|
22
|
|
|
|
|
41
|
|
|
22
|
|
|
|
|
9444
|
|
27
|
|
|
|
|
|
|
our @ISA = qw(Mail::SpamAssassin::Plugin); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# constructor: register the eval rule |
30
|
|
|
|
|
|
|
my $class = shift; |
31
|
|
|
|
|
|
|
my $mailsaobject = shift; |
32
|
63
|
|
|
63
|
1
|
196
|
|
33
|
63
|
|
|
|
|
132
|
# some boilerplate... |
34
|
|
|
|
|
|
|
$class = ref($class) || $class; |
35
|
|
|
|
|
|
|
my $self = $class->SUPER::new($mailsaobject); |
36
|
63
|
|
33
|
|
|
354
|
bless ($self, $class); |
37
|
63
|
|
|
|
|
320
|
|
38
|
63
|
|
|
|
|
147
|
# the important bit! |
39
|
|
|
|
|
|
|
$self->register_eval_rule("check_for_http_redirector"); |
40
|
|
|
|
|
|
|
$self->register_eval_rule("check_https_ip_mismatch"); |
41
|
63
|
|
|
|
|
236
|
$self->register_eval_rule("check_uri_truncated"); |
42
|
63
|
|
|
|
|
175
|
|
43
|
63
|
|
|
|
|
209
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
63
|
|
|
|
|
468
|
|
46
|
|
|
|
|
|
|
########################################################################### |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my ($self, $pms) = @_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
foreach ($pms->get_uri_list()) { |
51
|
0
|
|
|
0
|
0
|
|
while (s{^https?://([^/:\?]+).+?(https?:/{0,2}?([^/:\?]+).*)$}{$2}i) { |
52
|
|
|
|
|
|
|
my ($redir, $dest) = ($1, $3); |
53
|
0
|
|
|
|
|
|
foreach ($redir, $dest) { |
54
|
0
|
|
|
|
|
|
$_ = $self->{main}->{registryboundaries}->uri_to_domain($_) || $_; |
55
|
0
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
next if ($redir eq $dest); |
57
|
0
|
|
0
|
|
|
|
dbg("eval: redirect: found $redir to $dest, flagging"); |
58
|
|
|
|
|
|
|
return 1; |
59
|
0
|
0
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
} |
61
|
0
|
|
|
|
|
|
return 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
########################################################################### |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my ($self, $pms) = @_; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
while (my($k,$v) = each %{$pms->{html}->{uri_detail}}) { |
69
|
|
|
|
|
|
|
next if ($k !~ m%^https?:/*(?:[^\@/]+\@)?\d+\.\d+\.\d+\.\d+%i); |
70
|
0
|
|
|
0
|
0
|
|
foreach (@{$v->{anchor_text}}) { |
71
|
|
|
|
|
|
|
next if (m%^https:/*(?:[^\@/]+\@)?\d+\.\d+\.\d+\.\d+%i); |
72
|
0
|
|
|
|
|
|
if (m%https:%i) { |
|
0
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
keys %{$self->{html}->{uri_detail}}; # resets iterator, bug 4829 |
74
|
0
|
|
|
|
|
|
return 1; |
|
0
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
} |
76
|
0
|
0
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
} |
|
0
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return 0; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
########################################################################### |
83
|
0
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# is there a better way to do this? |
85
|
|
|
|
|
|
|
my ($self, $pms) = @_; |
86
|
|
|
|
|
|
|
return $pms->{'uri_truncated'}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |