line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Whois commands for .WS (RFC3912) |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2008,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::WS; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
824
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
834
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Net::DRI::Protocol::Whois::Domain::WS - .WS 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) 2008,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('domain '.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_registrar($po,$domain,$rr,$rinfo); |
96
|
0
|
|
|
|
|
|
parse_contacts($po,$domain,$rr,$rinfo); |
97
|
0
|
|
|
|
|
|
parse_dates($po,$domain,$rd,$rinfo); |
98
|
0
|
|
|
|
|
|
parse_ns($po,$domain,$rd,$rinfo); |
99
|
0
|
|
|
|
|
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub parse_domain |
103
|
|
|
|
|
|
|
{ |
104
|
0
|
|
|
0
|
0
|
|
my ($po,$rr,$rd,$rinfo)=@_; |
105
|
0
|
|
|
|
|
|
my ($dom,$e); |
106
|
0
|
0
|
|
|
|
|
if (exists($rr->{'Domain Name'})) |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
|
|
|
$e=1; |
109
|
0
|
|
|
|
|
|
$dom=lc($rr->{'Domain Name'}->[0]); |
110
|
|
|
|
|
|
|
} else ## may also be invalid domain name or reserved domain name |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
|
|
|
$e=0; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
|
|
|
|
|
return ($dom,$e); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
## Does not seem to be always there ! (present for whatever.ws, not present for website.ws) |
118
|
|
|
|
|
|
|
sub parse_registrar |
119
|
|
|
|
|
|
|
{ |
120
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rr,$rinfo)=@_; |
121
|
0
|
0
|
0
|
|
|
|
$rinfo->{domain}->{$domain}->{clName}=$rr->{'Registrar Name'}->[0] if (exists($rr->{'Registrar Name'}) && $rr->{'Registrar Name'}->[0]) ; |
122
|
0
|
0
|
0
|
|
|
|
$rinfo->{domain}->{$domain}->{clEmail}=$rr->{'Registrar Email'}->[0] if (exists($rr->{'Registrar Email'}) && $rr->{'Registrar Email'}->[0]); |
123
|
0
|
0
|
0
|
|
|
|
$rinfo->{domain}->{$domain}->{clVoice}=$rr->{'Registrar Telephone'}->[0] if (exists($rr->{'Registrar Telephone'}) && $rr->{'Registrar Telephone'}->[0]); |
124
|
0
|
0
|
0
|
|
|
|
$rinfo->{domain}->{$domain}->{clWhois}=$rr->{'Registrar Whois'}->[0] if (exists($rr->{'Registrar Whois'}) &&$rr->{'Registrar Whois'}->[0]) ; |
125
|
0
|
|
|
|
|
|
return; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
## Does not seem to be always there (see previous example, opposite case) |
129
|
|
|
|
|
|
|
sub parse_contacts |
130
|
|
|
|
|
|
|
{ |
131
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rr,$rinfo)=@_; |
132
|
0
|
|
|
|
|
|
my $cs=$po->create_local_object('contactset'); |
133
|
|
|
|
|
|
|
|
134
|
0
|
0
|
0
|
|
|
|
if (exists($rr->{'Registrant Name'}) && $rr->{'Registrant Name'}->[0]) |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
|
|
|
|
my $c=$po->create_local_object('contact'); |
137
|
0
|
|
|
|
|
|
$c->name($rr->{'Registrant Name'}->[0]); |
138
|
0
|
|
|
|
|
|
$c->email($rr->{'Registrant Email'}->[0]); |
139
|
0
|
|
|
|
|
|
$cs->add($c,'registrant'); |
140
|
|
|
|
|
|
|
} |
141
|
0
|
0
|
0
|
|
|
|
if (exists($rr->{'Administrative Contact Email'}) && $rr->{'Administrative Contact Email'}->[0]) |
142
|
|
|
|
|
|
|
{ |
143
|
0
|
|
|
|
|
|
my $c=$po->create_local_object('contact'); |
144
|
0
|
|
|
|
|
|
$c->email($rr->{'Administrative Contact Email'}->[0]); |
145
|
0
|
|
|
|
|
|
$c->voice($rr->{'Administrative Contact Telephone'}->[0]); |
146
|
0
|
|
|
|
|
|
$cs->add($c,'admin'); |
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{contact}=$cs; |
149
|
0
|
|
|
|
|
|
return; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub parse_dates |
153
|
|
|
|
|
|
|
{ |
154
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rd,$rinfo)=@_; |
155
|
0
|
|
|
|
|
|
my $strp=$po->build_strptime_parser(pattern => '%Y-%m-%d %T', time_zone => 'America/Los_Angeles'); |
156
|
0
|
|
|
|
|
|
my @tmp; |
157
|
0
|
|
|
|
|
|
@tmp=grep { m/Domain created on/ } @$rd; |
|
0
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
$rinfo->{domain}->{$domain}->{crDate}=$strp->parse_datetime(($tmp[0]=~m/^\s+Domain created on (\S+ \S+)\s*$/)[0]) if @tmp; |
159
|
0
|
|
|
|
|
|
@tmp=grep { m/Domain last updated on/ } @$rd; |
|
0
|
|
|
|
|
|
|
160
|
0
|
0
|
|
|
|
|
$rinfo->{domain}->{$domain}->{upDate}=$strp->parse_datetime(($tmp[0]=~m/^\s+Domain last updated on (\S+ \S+)\s*$/)[0]) if @tmp; |
161
|
0
|
|
|
|
|
|
return; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub parse_ns |
165
|
|
|
|
|
|
|
{ |
166
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$rd,$rinfo)=@_; |
167
|
0
|
|
|
|
|
|
my @ns; |
168
|
0
|
|
|
|
|
|
foreach my $l (@$rd) |
169
|
|
|
|
|
|
|
{ |
170
|
0
|
0
|
|
|
|
|
next unless (($l=~m/^\s+ Current Nameservers:/)..1); |
171
|
0
|
0
|
|
|
|
|
push @ns,$1 if ($l=~m/^\s*(\S+[^\.])\.?\s*$/); |
172
|
|
|
|
|
|
|
} |
173
|
0
|
0
|
|
|
|
|
$rinfo->{domain}->{$domain}->{ns}=$po->create_local_object('hosts')->set(@ns) if @ns; |
174
|
0
|
|
|
|
|
|
return; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
#################################################################################################### |
178
|
|
|
|
|
|
|
1; |