line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Whois commands for .SE (RFC3912) |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2009,2013 Patrick Mevzek . All rights reserved. |
4
|
|
|
|
|
|
|
## |
5
|
|
|
|
|
|
|
## This file is part of Net::DRI |
6
|
|
|
|
|
|
|
## |
7
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
8
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
9
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
|
|
|
|
## (at your option) any later version. |
11
|
|
|
|
|
|
|
## |
12
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
13
|
|
|
|
|
|
|
#################################################################################################### |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Net::DRI::Protocol::Whois::Domain::PT; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
825
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
861
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Net::DRI::Protocol::Whois::Domain::PT - .PT Whois commands (RFC3912) for Net::DRI |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Please see the README file for details. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SUPPORT |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
For now, support questions should be sent to: |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SEE ALSO |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 COPYRIGHT |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Copyright (c) 2009,2013 Patrick Mevzek . |
52
|
|
|
|
|
|
|
All rights reserved. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
55
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
56
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
57
|
|
|
|
|
|
|
(at your option) any later version. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#################################################################################################### |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub register_commands |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
68
|
0
|
|
|
|
|
|
return { 'domain' => { info => [ \&info, \&info_parse ] } }; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub info |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rd)=@_; |
74
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
75
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/whois',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain); |
76
|
0
|
|
|
|
|
|
$mes->command(lc $domain); |
77
|
0
|
|
|
|
|
|
return; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub info_parse |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
83
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
84
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $rr=$mes->response(); |
87
|
0
|
|
|
|
|
|
my $rd=$mes->response_raw(); |
88
|
0
|
|
|
|
|
|
my ($domain,$exist)=parse_domain($po,$rr,$rd,$rinfo); |
89
|
0
|
0
|
|
|
|
|
$domain=lc($oname) unless defined($domain); |
90
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{exist}=$exist; |
91
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{action}='info'; |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
return unless $exist; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
parse_dates($po,$domain,$rr,$rinfo); |
96
|
0
|
|
|
|
|
|
parse_contacts($po,$domain,$rr,$rd,$rinfo); |
97
|
0
|
|
|
|
|
|
parse_ns($po,$domain,$rr,$rinfo); |
98
|
0
|
|
|
|
|
|
return; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub parse_domain |
102
|
|
|
|
|
|
|
{ |
103
|
0
|
|
|
0
|
0
|
|
my ($po,$rr,$rd,$rinfo)=@_; |
104
|
0
|
|
|
|
|
|
my ($dom,$e); |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if (exists($rr->{"Nome de dom\x{ED}nio / Domain Name"})) |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
|
|
|
$e=1; |
109
|
0
|
|
|
|
|
|
$dom=lc($rr->{"Nome de dom\x{ED}nio / Domain Name"}->[0]); |
110
|
|
|
|
|
|
|
} else |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
|
|
|
$e=0; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
|
|
|
|
|
return ($dom,$e); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub parse_dates |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rr,$rinfo)=@_; |
120
|
0
|
|
|
|
|
|
my $strp=$po->build_strptime_parser(pattern => '%d/%m/%Y', time_zone => 'Europe/Lisbon'); |
121
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{crDate}=$strp->parse_datetime($rr->{'Data de registo / Creation Date (dd/mm/yyyy)'}->[0]); |
122
|
0
|
|
|
|
|
|
return; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub parse_contacts |
126
|
|
|
|
|
|
|
{ |
127
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rr,$rd,$rinfo)=@_; |
128
|
0
|
|
|
|
|
|
my $cs=$po->create_local_object('contactset'); |
129
|
0
|
|
|
|
|
|
my @m=qw/name street city pc cc email/; |
130
|
0
|
|
|
|
|
|
my @t=qw/billing admin tech/; |
131
|
0
|
|
|
|
|
|
my $c; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
foreach my $l (@$rd) |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
|
|
|
|
|
$l=~s/^\s+//; |
136
|
0
|
|
|
|
|
|
$l=~s/\s+$//; |
137
|
|
|
|
|
|
|
|
138
|
0
|
0
|
|
|
|
|
if (($l=~m!Titular / Registrant!)..($l=~m/^\s*$/)) |
139
|
|
|
|
|
|
|
{ |
140
|
0
|
0
|
|
|
|
|
next if ($l eq 'Titular / Registrant'); |
141
|
0
|
0
|
|
|
|
|
if ($l=~m/^\s*$/) |
142
|
|
|
|
|
|
|
{ |
143
|
0
|
|
|
|
|
|
$cs->add($c,'registrant'); |
144
|
0
|
|
|
|
|
|
$c=undef; |
145
|
0
|
|
|
|
|
|
next; |
146
|
|
|
|
|
|
|
} |
147
|
0
|
|
|
|
|
|
$l=~s/^Email:\s+//; |
148
|
0
|
0
|
|
|
|
|
$c=$po->create_local_object('contact') unless defined $c; |
149
|
0
|
|
|
|
|
|
my $m=shift(@m); |
150
|
0
|
0
|
|
|
|
|
$c->$m($m eq 'street'? [$l] : $l); |
151
|
|
|
|
|
|
|
} |
152
|
0
|
0
|
|
|
|
|
if (($l=~m!^(Entidade Gestora / Billing Contact|Respons\x{E1}vel Administrativo / Admin Contact|Respons\x{E1}vel T\x{E9}cnico / Tech Contact)$!)..($l=~m/^\s*$/)) |
153
|
|
|
|
|
|
|
{ |
154
|
0
|
0
|
|
|
|
|
next if $l=~m! / \S+ Contact$!; |
155
|
0
|
0
|
|
|
|
|
if ($l=~m/^\s*$/) |
156
|
|
|
|
|
|
|
{ |
157
|
0
|
|
|
|
|
|
$cs->add($c,shift(@t)); |
158
|
0
|
|
|
|
|
|
$c=undef; |
159
|
0
|
|
|
|
|
|
next; |
160
|
|
|
|
|
|
|
} |
161
|
0
|
0
|
|
|
|
|
if ($l=~s/^Email:\s+//) |
162
|
|
|
|
|
|
|
{ |
163
|
0
|
|
|
|
|
|
$c->email($l); |
164
|
|
|
|
|
|
|
} else |
165
|
|
|
|
|
|
|
{ |
166
|
0
|
|
|
|
|
|
$c=$po->create_local_object('contact'); |
167
|
0
|
|
|
|
|
|
$c->name($l); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} |
171
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{contact}=$cs; |
172
|
0
|
|
|
|
|
|
return; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub parse_ns |
176
|
|
|
|
|
|
|
{ |
177
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rr,$rinfo)=@_; |
178
|
0
|
0
|
|
|
|
|
return unless (exists($rr->{Nameserver})); |
179
|
0
|
|
|
|
|
|
my $h=$po->create_local_object('hosts'); |
180
|
0
|
0
|
|
|
|
|
foreach my $ns (grep { defined($_) && $_ } @{$rr->{Nameserver}}) |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
{ |
182
|
0
|
|
|
|
|
|
$h->add($ns); |
183
|
|
|
|
|
|
|
} |
184
|
0
|
0
|
|
|
|
|
$rinfo->{domain}->{$domain}->{ns}=$h unless $h->is_empty(); |
185
|
0
|
|
|
|
|
|
return; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
#################################################################################################### |
189
|
|
|
|
|
|
|
1; |