line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Maps::Lookup; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
42151
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $LIBRARY); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use Exporter (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
8
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
@EXPORT_OK = qw(host activation_code ip_address); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.02'; |
12
|
|
|
|
|
|
|
$LIBRARY = __PACKAGE__; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
1157
|
use Net::DNS; |
|
1
|
|
|
|
|
110149
|
|
|
1
|
|
|
|
|
551
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$|=1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
1
|
|
|
1
|
1
|
18
|
my $class = shift; |
20
|
1
|
|
|
|
|
4
|
my $self = bless {}, $class; |
21
|
1
|
|
|
|
|
8
|
return $self->init(@_); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
26
|
1
|
|
|
|
|
6
|
my %args = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
14
|
map($self->{$_}=$args{$_}, keys %args); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
5
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub lookup { |
34
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
3
|
my $host = $self->{host}; |
37
|
1
|
|
|
|
|
2
|
my $activation_code = $self->{activation_code}; |
38
|
1
|
|
|
|
|
3
|
my $ip_address = $self->{ip_address}; |
39
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
3
|
$host = $host ? $host : "r.mail-abuse.com"; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
4
|
my $reverse_ip_address = reverse_ip($ip_address); |
43
|
1
|
|
|
|
|
5
|
my $address = "0.0.0.0.$activation_code.r.mail-abuse.com."; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
23
|
my $res = Net::DNS::Resolver->new; |
46
|
1
|
|
|
|
|
634
|
my $query = $res->search("$address",'A'); |
47
|
|
|
|
|
|
|
|
48
|
1
|
50
|
|
|
|
16385
|
if ($query){ |
49
|
0
|
0
|
|
|
|
0
|
if ($res->errorstring =~ /NOERROR/){ |
50
|
0
|
|
|
|
|
0
|
my $address = "$reverse_ip_address.$activation_code.$host."; |
51
|
0
|
|
|
|
|
0
|
my $res = Net::DNS::Resolver->new; |
52
|
0
|
|
|
|
|
0
|
my $query = $res->search("$address",'A'); |
53
|
0
|
0
|
|
|
|
0
|
if ($res->errorstring =~ /NOERROR/){ |
54
|
0
|
|
|
|
|
0
|
foreach my $rr ($query->answer){ |
55
|
0
|
0
|
|
|
|
0
|
if ($rr->type eq "A"){ |
56
|
0
|
|
|
|
|
0
|
$res = "address"; |
57
|
0
|
0
|
|
|
|
0
|
if ($rr->$res){ |
58
|
|
|
|
|
|
|
# listed |
59
|
0
|
|
|
|
|
0
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} else{ |
64
|
|
|
|
|
|
|
# not listed |
65
|
0
|
|
|
|
|
0
|
return 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} else{ |
69
|
|
|
|
|
|
|
# unable to connect to maps server or invalid activation code |
70
|
1
|
|
|
|
|
23
|
return 2; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub reverse_ip { |
75
|
1
|
|
|
1
|
0
|
3
|
my $ip = shift; |
76
|
1
|
|
|
|
|
6
|
my @ad = split ('\.', $ip); |
77
|
1
|
|
|
|
|
7
|
return join('.', reverse(@ad)); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
__END__ |