line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::WhoisNG; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#use 5.008004; |
4
|
1
|
|
|
1
|
|
19568
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
103
|
|
7
|
1
|
|
|
1
|
|
912
|
use IO::Socket; |
|
1
|
|
|
|
|
29092
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
1663
|
use IO::File; |
|
1
|
|
|
|
|
2852
|
|
|
1
|
|
|
|
|
180
|
|
9
|
1
|
|
|
1
|
|
727
|
use Net::WhoisNG::Person; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
10
|
1
|
|
|
1
|
|
3166
|
use Data::Dumper; |
|
1
|
|
|
|
|
10185
|
|
|
1
|
|
|
|
|
6029
|
|
11
|
|
|
|
|
|
|
#use AutoLoader 'AUTOLOAD'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Exporter; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
18
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
19
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# This allows declaration use Net::WhoisNG ':all'; |
22
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
23
|
|
|
|
|
|
|
# will save memory. |
24
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
) ] ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our @EXPORT = qw( |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new{ |
37
|
1
|
|
|
1
|
0
|
15
|
my $class=shift; |
38
|
1
|
|
|
|
|
4
|
my $self={}; |
39
|
1
|
|
|
|
|
4
|
my $domain=shift; |
40
|
1
|
|
|
|
|
2
|
my $tld; |
41
|
|
|
|
|
|
|
my $drop; |
42
|
1
|
|
|
|
|
4
|
$domain=~ s/\s+//g; |
43
|
1
|
|
|
|
|
3
|
$domain=~ s/\n+//g; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
6
|
($drop,$tld)=split(/\./,$domain); |
46
|
1
|
|
|
|
|
4
|
$self->{domain}=$domain; |
47
|
|
|
|
|
|
|
#now we try to connect to repective tld serverl |
48
|
1
|
|
|
|
|
3
|
my $server="$tld.whois-servers.net"; |
49
|
1
|
|
|
|
|
3
|
$self->{server}=$server; |
50
|
1
|
|
|
|
|
2
|
bless $self; |
51
|
1
|
|
|
|
|
2
|
my %tree ; |
52
|
1
|
|
|
|
|
7
|
$self->{tree}=\%tree; |
53
|
1
|
|
|
|
|
4
|
return $self; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub getConnection{ |
57
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
58
|
0
|
|
|
|
|
0
|
return $self->{socket}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub lookUp{ |
62
|
2
|
|
|
2
|
0
|
299
|
my $self=shift; |
63
|
2
|
|
|
|
|
4
|
my $raw_domain; |
64
|
|
|
|
|
|
|
my $domain; |
65
|
2
|
|
|
|
|
5
|
my $server=$self->{server}; |
66
|
2
|
50
|
|
|
|
6
|
if($self->{domain}){ |
67
|
2
|
|
|
|
|
6
|
$raw_domain=$self->{domain}; |
68
|
|
|
|
|
|
|
} |
69
|
2
|
50
|
|
|
|
108083
|
my $ip = gethostbyname($server) or die "Failed gethostbyname $server\n"; |
70
|
2
|
|
|
|
|
34
|
$ip = inet_ntoa($ip); |
71
|
2
|
50
|
0
|
|
|
38
|
my $sock = IO::Socket::INET->new(PeerAddr => $ip, PeerPort => 'whois', Proto => 'tcp') or print "Socket to $ip failed on $raw_domain\n" and return 0; |
72
|
2
|
|
|
|
|
184781
|
$sock->autoflush(); |
73
|
2
|
50
|
|
|
|
168
|
if($sock){ |
74
|
2
|
|
|
|
|
12
|
$self->{socket}=$sock; |
75
|
|
|
|
|
|
|
}else{ |
76
|
0
|
|
|
|
|
0
|
print "Bad Socket. Exiting ...\n"; |
77
|
0
|
|
|
|
|
0
|
exit; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
155
|
$domain=$self->fixFormat($raw_domain); |
81
|
2
|
|
|
|
|
231
|
print $sock uc("$domain\n"); |
82
|
2
|
|
|
|
|
184821
|
my @rslts=<$sock>; |
83
|
2
|
50
|
|
|
|
34
|
if($domain=~ /com$|.net$/){ |
84
|
0
|
|
|
|
|
0
|
for(my $n=0;$n<@rslts;$n++){ |
85
|
0
|
0
|
|
|
|
0
|
if($rslts[$n]=~ /Whois Server:\s+(\S+)\s+/){ |
86
|
0
|
|
|
|
|
0
|
$server=$1; |
87
|
0
|
|
|
|
|
0
|
$sock->close(); |
88
|
0
|
0
|
|
|
|
0
|
$ip = gethostbyname($server) or die "Failed gethostbyname\n"; |
89
|
0
|
|
|
|
|
0
|
$ip = inet_ntoa($ip); |
90
|
0
|
0
|
0
|
|
|
0
|
$sock = IO::Socket::INET->new(PeerAddr => $ip, PeerPort => 'whois', Proto => 'tcp',Timeout => "5",) or print "Socket failed on $raw_domain\n" and return 0; |
91
|
0
|
|
|
|
|
0
|
$sock->autoflush(); |
92
|
0
|
|
|
|
|
0
|
print $sock uc("$raw_domain\n"); |
93
|
0
|
|
|
|
|
0
|
@rslts=<$sock>; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
$sock->close(); |
96
|
|
|
|
|
|
|
# exit; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
2
|
|
|
|
|
12
|
$self->{rslts}=\@rslts; |
101
|
2
|
|
|
|
|
23
|
my $rst=$self->parseResult(); |
102
|
2
|
|
|
|
|
24
|
return $rst; |
103
|
|
|
|
|
|
|
#print @rslts; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub fixFormat{ |
108
|
2
|
|
|
2
|
0
|
6
|
my $self=shift; |
109
|
2
|
|
|
|
|
39
|
my $domain=shift; |
110
|
2
|
|
|
|
|
18
|
my ($drop,$tld)=split(/\./,$domain); |
111
|
2
|
50
|
|
|
|
19
|
if($tld=~ /com/i){ |
112
|
0
|
|
|
|
|
0
|
return "domain $domain"; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
else{ |
115
|
2
|
|
|
|
|
8
|
return $domain; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub setRegistrant{ |
120
|
0
|
|
|
0
|
0
|
0
|
my($self, $registrant)=@_; |
121
|
0
|
|
|
|
|
0
|
$self->{'registrant'}=$registrant; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub getRegistrant{ |
125
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
126
|
0
|
|
|
|
|
0
|
return $self->{'registrant'}; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub parseResult{ |
130
|
2
|
|
|
2
|
0
|
5
|
my $self=shift; |
131
|
2
|
|
|
|
|
6
|
my $rslt_ref=$self->{rslts}; |
132
|
2
|
|
|
|
|
35
|
my @rslts=@$rslt_ref; |
133
|
2
|
|
|
|
|
5
|
my $capadmin=0; |
134
|
2
|
|
|
|
|
4
|
my $captech=0; |
135
|
2
|
|
|
|
|
4
|
my $capns=0; |
136
|
2
|
|
|
|
|
4
|
my $cappin=0; |
137
|
2
|
|
|
|
|
5
|
my $capregistrant; |
138
|
|
|
|
|
|
|
my $offset; |
139
|
0
|
|
|
|
|
0
|
my @tcap; |
140
|
2
|
|
|
|
|
5
|
$self->{nameservers}=undef; |
141
|
|
|
|
|
|
|
|
142
|
2
|
|
|
|
|
8
|
foreach my $line(@rslts){ |
143
|
138
|
|
|
|
|
310
|
$line=~ s/\t/ /g; |
144
|
|
|
|
|
|
|
## Do com and .net specific parsing |
145
|
138
|
50
|
|
|
|
7221
|
if($self->{domain}=~ /.com$|.net$|.tv$/){ |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
0
|
if($line=~ /No Match/i){ |
147
|
0
|
|
|
|
|
0
|
return 0; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
0
|
if($line=~ /Registrar:\s+((\S+)\s+)+/g){ |
|
|
0
|
|
|
|
|
|
151
|
0
|
|
|
|
|
0
|
$self->setRegistrar($2); |
152
|
|
|
|
|
|
|
# print "got $2\n"; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
elsif($line=~ /Registrant:\s+((\S+)\s+)+/g){ |
155
|
0
|
|
|
|
|
0
|
$self->setRegistrant($2); |
156
|
|
|
|
|
|
|
} |
157
|
0
|
0
|
|
|
|
0
|
if($line=~ /Registrar\s+Name:\s+((\S+)\s+)+/g){ |
158
|
0
|
|
|
|
|
0
|
$self->setRegistrar($2); |
159
|
0
|
|
|
|
|
0
|
next; |
160
|
|
|
|
|
|
|
} |
161
|
0
|
|
|
|
|
0
|
my $raw_date; |
162
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /created on\s+(\S+)./ or $line=~ /Created on\S*:\s+(\S+)\s+$/i or $line=~ /Created on\S+:\s+((\S+\s+)+)/){ |
|
|
|
0
|
|
|
|
|
163
|
0
|
|
|
|
|
0
|
$raw_date=$1; |
164
|
0
|
|
|
|
|
0
|
$self->setCreatedDate($self->sanitizeDate("$raw_date")); |
165
|
0
|
|
|
|
|
0
|
next; |
166
|
|
|
|
|
|
|
} |
167
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /Expires on\s+(\S+)./gi or $line=~ /expires on\S*:\s+(\S+)\s+$/i or $line=~ /expires on\S+:\s+((\S+\s+)+)/gi){ |
|
|
|
0
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
$raw_date=$1; |
169
|
|
|
|
|
|
|
#print "Date is $raw_date\n"; |
170
|
0
|
|
|
|
|
0
|
$self->setExpirationDate($self->sanitizeDate("$raw_date")); |
171
|
|
|
|
|
|
|
} |
172
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /updated on\s+(\S+)\./i or $line=~ /updated on\S*:\s+(\S+)\s+$/i or $line=~ /updated on\S+:\s+((\S+\s+)+)/i){ |
|
|
|
0
|
|
|
|
|
173
|
0
|
|
|
|
|
0
|
$raw_date=$1; |
174
|
0
|
|
|
|
|
0
|
$self->setLastUpdated($self->sanitizeDate("$raw_date")); |
175
|
|
|
|
|
|
|
} |
176
|
0
|
0
|
0
|
|
|
0
|
if($capadmin or $captech or $capregistrant){ |
|
|
0
|
0
|
|
|
|
|
177
|
0
|
|
|
|
|
0
|
my $toffset=0; |
178
|
0
|
0
|
|
|
|
0
|
if($line=~ /(\s+)\S+/){ |
|
|
0
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
$toffset=length($1); |
180
|
|
|
|
|
|
|
# print "toffset is $toffset\n"; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
elsif($line=~ /^\s+$/){ |
183
|
0
|
|
|
|
|
0
|
$toffset=-1; |
184
|
|
|
|
|
|
|
} |
185
|
0
|
0
|
|
|
|
0
|
if($toffset>$offset){ |
186
|
0
|
|
|
|
|
0
|
chomp $line; |
187
|
0
|
|
|
|
|
0
|
push(@tcap,$line); |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
else{ |
190
|
|
|
|
|
|
|
#done Capturing |
191
|
0
|
0
|
|
|
|
0
|
if($capadmin){ |
192
|
|
|
|
|
|
|
#create new object for admin person |
193
|
0
|
|
|
|
|
0
|
my $admin=new Net::WhoisNG::Person(); |
194
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
195
|
0
|
|
|
|
|
0
|
$admin->{credentials}=\@cap; |
196
|
0
|
|
|
|
|
0
|
$self->addPerson($admin,"admin"); |
197
|
|
|
|
|
|
|
} |
198
|
0
|
0
|
|
|
|
0
|
if($captech){ |
199
|
|
|
|
|
|
|
#create tech person object if it doesnt exist |
200
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
201
|
0
|
|
|
|
|
0
|
my $tech=new Net::WhoisNG::Person(); |
202
|
0
|
|
|
|
|
0
|
$tech->{credentials}=\@cap; |
203
|
0
|
|
|
|
|
0
|
$self->addPerson($tech,"tech"); |
204
|
|
|
|
|
|
|
} |
205
|
0
|
|
|
|
|
0
|
undef @tcap; |
206
|
0
|
|
|
|
|
0
|
$captech=0; |
207
|
0
|
|
|
|
|
0
|
$capadmin=0; |
208
|
0
|
|
|
|
|
0
|
$capregistrant=0; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
elsif($capns){ |
212
|
0
|
0
|
|
|
|
0
|
if($line=~ /(\S+)/){ |
213
|
0
|
|
|
|
|
0
|
$cappin=1; |
214
|
0
|
|
|
|
|
0
|
push(@tcap,$line); |
215
|
0
|
0
|
|
|
|
0
|
if($rslts[$#rslts]=~ /$1/){ |
216
|
|
|
|
|
|
|
#done capturing. |
217
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
218
|
0
|
|
|
|
|
0
|
$self->{nameservers}=\@cap; |
219
|
0
|
|
|
|
|
0
|
$capns=0; |
220
|
0
|
|
|
|
|
0
|
$cappin=0; |
221
|
0
|
|
|
|
|
0
|
undef @tcap; |
222
|
|
|
|
|
|
|
} |
223
|
0
|
|
|
|
|
0
|
next; |
224
|
|
|
|
|
|
|
} |
225
|
0
|
0
|
0
|
|
|
0
|
if($cappin and ($line=~ /^\s+$/ )){ |
226
|
|
|
|
|
|
|
#done capturing |
227
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
228
|
0
|
|
|
|
|
0
|
$self->{nameservers}=\@cap; |
229
|
0
|
|
|
|
|
0
|
$capns=0; |
230
|
0
|
|
|
|
|
0
|
$cappin=0; |
231
|
0
|
|
|
|
|
0
|
undef @tcap; |
232
|
0
|
|
|
|
|
0
|
next; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
} |
235
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /Domain\s+servers/i or $line=~ /name\s+servers/i){ |
236
|
0
|
|
|
|
|
0
|
$capns=1; |
237
|
0
|
|
|
|
|
0
|
next; |
238
|
|
|
|
|
|
|
} |
239
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /(\s*)Administrative\s+Contact:/ or $line=~ /(\s*)Administrative\s+Contact(\S+\s+)(\S+)/){ |
240
|
0
|
|
|
|
|
0
|
$capadmin=1; |
241
|
0
|
0
|
|
|
|
0
|
if(defined($3)){ |
242
|
0
|
0
|
|
|
|
0
|
if($3=~ /techn/i){ |
243
|
0
|
|
|
|
|
0
|
$captech=1; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} |
246
|
0
|
|
|
|
|
0
|
$offset=length($1); |
247
|
|
|
|
|
|
|
#print "My offset is ",$offset,"\n"; |
248
|
0
|
|
|
|
|
0
|
next; |
249
|
|
|
|
|
|
|
} |
250
|
0
|
0
|
|
|
|
0
|
if($line=~/(\s*)Technical\s+Cont/i){ |
251
|
0
|
|
|
|
|
0
|
$captech=1; |
252
|
0
|
0
|
|
|
|
0
|
if($self->getPerson("tech")){ |
253
|
0
|
|
|
|
|
0
|
$captech=0; |
254
|
0
|
|
|
|
|
0
|
next; |
255
|
|
|
|
|
|
|
} |
256
|
0
|
|
|
|
|
0
|
$offset=length($1); |
257
|
|
|
|
|
|
|
#print "My offset is ",length($offset),"\n"; |
258
|
0
|
|
|
|
|
0
|
next; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
elsif($self->{domain}=~ /.edu/){ |
262
|
0
|
0
|
|
|
|
0
|
if($line=~ /^No Match/){ |
263
|
0
|
|
|
|
|
0
|
return 0; |
264
|
|
|
|
|
|
|
} |
265
|
0
|
|
|
|
|
0
|
my $raw_date; |
266
|
0
|
0
|
|
|
|
0
|
if($line=~ /activated:\s+(\S+)\s+$/i){ |
267
|
0
|
|
|
|
|
0
|
$raw_date=$1; |
268
|
0
|
|
|
|
|
0
|
$self->setCreatedDate($self->sanitizeDate("$raw_date")); |
269
|
0
|
|
|
|
|
0
|
next; |
270
|
|
|
|
|
|
|
} |
271
|
0
|
0
|
|
|
|
0
|
if($line=~ /updated:\s+(\S+)\s+$/i){ |
272
|
0
|
|
|
|
|
0
|
$raw_date=$1; |
273
|
0
|
|
|
|
|
0
|
$self->setLastUpdated($self->sanitizeDate("$raw_date")); |
274
|
|
|
|
|
|
|
} |
275
|
0
|
0
|
0
|
|
|
0
|
if($capadmin or $captech or $capregistrant){ |
|
|
0
|
0
|
|
|
|
|
276
|
0
|
|
|
|
|
0
|
my $toffset; |
277
|
0
|
|
|
|
|
0
|
my $cont=0; |
278
|
0
|
0
|
|
|
|
0
|
if($line=~ /^\s+$/){ |
279
|
|
|
|
|
|
|
#print "Current tcap size:",@tcap+0;; |
280
|
0
|
0
|
|
|
|
0
|
if(!@tcap){ |
281
|
|
|
|
|
|
|
#print "Unnecessary space\n"; |
282
|
0
|
|
|
|
|
0
|
next; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
else{ |
285
|
0
|
|
|
|
|
0
|
$cont=1; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
else{ |
289
|
|
|
|
|
|
|
#capture lines |
290
|
0
|
|
|
|
|
0
|
chomp $line; |
291
|
0
|
|
|
|
|
0
|
push(@tcap,$line); |
292
|
0
|
|
|
|
|
0
|
next; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
#done Capturing |
295
|
0
|
0
|
|
|
|
0
|
if($capadmin){ |
296
|
|
|
|
|
|
|
#create new object for admin person |
297
|
0
|
0
|
|
|
|
0
|
if(@tcap<1){ |
298
|
0
|
|
|
|
|
0
|
next; |
299
|
|
|
|
|
|
|
} |
300
|
0
|
|
|
|
|
0
|
my $admin=new Net::WhoisNG::Person(); |
301
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
302
|
0
|
|
|
|
|
0
|
$admin->{credentials}=\@cap; |
303
|
0
|
|
|
|
|
0
|
$self->addPerson($admin,"admin"); |
304
|
|
|
|
|
|
|
} |
305
|
0
|
0
|
|
|
|
0
|
if($captech){ |
306
|
0
|
0
|
|
|
|
0
|
if(@tcap<1){ |
307
|
0
|
|
|
|
|
0
|
next; |
308
|
|
|
|
|
|
|
} |
309
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
310
|
0
|
|
|
|
|
0
|
my $tech=new Net::WhoisNG::Person(); |
311
|
0
|
|
|
|
|
0
|
$tech->{credentials}=\@cap; |
312
|
0
|
|
|
|
|
0
|
$self->addPerson($tech,"tech"); |
313
|
|
|
|
|
|
|
} |
314
|
0
|
|
|
|
|
0
|
undef @tcap; |
315
|
0
|
|
|
|
|
0
|
$captech=0; |
316
|
0
|
|
|
|
|
0
|
$capadmin=0; |
317
|
0
|
|
|
|
|
0
|
$capregistrant=0; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
elsif($capns){ |
321
|
0
|
0
|
|
|
|
0
|
if($line=~ /(\S+)/){ |
322
|
0
|
|
|
|
|
0
|
$cappin=1; |
323
|
0
|
|
|
|
|
0
|
push(@tcap,$line); |
324
|
0
|
0
|
|
|
|
0
|
if($rslts[$#rslts]=~ /$1/){ |
325
|
|
|
|
|
|
|
#done capturing. |
326
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
327
|
0
|
|
|
|
|
0
|
$self->{nameservers}=\@cap; |
328
|
0
|
|
|
|
|
0
|
$capns=0; |
329
|
0
|
|
|
|
|
0
|
$cappin=0; |
330
|
0
|
|
|
|
|
0
|
undef @tcap; |
331
|
|
|
|
|
|
|
} |
332
|
0
|
|
|
|
|
0
|
next; |
333
|
|
|
|
|
|
|
} |
334
|
0
|
0
|
0
|
|
|
0
|
if($cappin and ($line=~ /^\s+$/ )){ |
335
|
|
|
|
|
|
|
#done capturing |
336
|
0
|
|
|
|
|
0
|
my @cap=@tcap; |
337
|
0
|
|
|
|
|
0
|
$self->{nameservers}=\@cap; |
338
|
0
|
|
|
|
|
0
|
$capns=0; |
339
|
0
|
|
|
|
|
0
|
$cappin=0; |
340
|
0
|
|
|
|
|
0
|
undef @tcap; |
341
|
0
|
|
|
|
|
0
|
next; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
} |
344
|
0
|
0
|
|
|
|
0
|
if($line=~ /name\s+servers:/i){ |
345
|
0
|
|
|
|
|
0
|
$capns=1; |
346
|
0
|
|
|
|
|
0
|
next; |
347
|
|
|
|
|
|
|
} |
348
|
0
|
0
|
|
|
|
0
|
if($line=~ /(\s*)Administrative\s+Contact:/){ |
349
|
0
|
|
|
|
|
0
|
$capadmin=1; |
350
|
0
|
|
|
|
|
0
|
undef @tcap; |
351
|
0
|
|
|
|
|
0
|
next; |
352
|
|
|
|
|
|
|
} |
353
|
0
|
0
|
|
|
|
0
|
if($line=~/(\s*)Technical\s+Cont/i){ |
354
|
0
|
|
|
|
|
0
|
$captech=1; |
355
|
0
|
|
|
|
|
0
|
undef @tcap; |
356
|
0
|
|
|
|
|
0
|
next; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
elsif($self->{domain}=~ /.org$|.info$|.us$/i) { |
360
|
|
|
|
|
|
|
# Above extensions are the most code friendly |
361
|
|
|
|
|
|
|
#Registrant Street1:Whareroa Rd |
362
|
138
|
50
|
|
|
|
337
|
if($line=~ /NOT\s+FOUND/){ |
363
|
0
|
|
|
|
|
0
|
return 0; |
364
|
|
|
|
|
|
|
} |
365
|
138
|
|
|
|
|
374
|
$line =~ s/:\s+/:/g; |
366
|
|
|
|
|
|
|
|
367
|
138
|
100
|
|
|
|
608
|
if($line=~ /^(Bill|^Admin|^Tech|^Registrant)/){ |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
368
|
|
|
|
|
|
|
|
369
|
78
|
|
|
|
|
275
|
my $key=$1; |
370
|
|
|
|
|
|
|
# Remove for parsing .us |
371
|
78
|
|
|
|
|
188
|
$line =~ s/contact//i; |
372
|
78
|
|
|
|
|
136
|
$line =~ s/:\s+/:/g; |
373
|
78
|
|
|
|
|
733
|
$line =~ /(\S+)(\s+\S+){1,2}:((\S+\s+)+)/; |
374
|
|
|
|
|
|
|
#check if person object exists and get handle |
375
|
78
|
|
|
|
|
90
|
my ( $val, $prop); |
376
|
|
|
|
|
|
|
#print $key . "\n"; |
377
|
78
|
|
|
|
|
96
|
$prop="none"; |
378
|
|
|
|
|
|
|
|
379
|
78
|
100
|
|
|
|
203
|
if($2){ |
380
|
60
|
|
|
|
|
110
|
$prop=$2; |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
|
383
|
78
|
100
|
|
|
|
187
|
if($3){ |
384
|
60
|
|
|
|
|
88
|
$val=$3; |
385
|
60
|
|
|
|
|
80
|
chomp $val; |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
78
|
|
|
|
|
111
|
$key=lc($key); |
389
|
78
|
|
|
|
|
83
|
my $person; |
390
|
|
|
|
|
|
|
|
391
|
78
|
100
|
|
|
|
164
|
if($self->getPerson($key)){ |
392
|
75
|
|
|
|
|
218
|
$person=$self->getPerson($key); |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
else{ |
395
|
3
|
|
|
|
|
92
|
$person=new Net::WhoisNG::Person(); |
396
|
3
|
|
|
|
|
11
|
$self->addPerson($person,$key); |
397
|
|
|
|
|
|
|
} |
398
|
78
|
50
|
|
|
|
677
|
if($prop=~ /ID:/i){ |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
399
|
0
|
|
|
|
|
0
|
$person->setID($val); |
400
|
0
|
|
|
|
|
0
|
next; |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
elsif($prop=~ /name/i){ |
403
|
6
|
|
|
|
|
31
|
$person->setName($val); |
404
|
6
|
|
|
|
|
14
|
next; |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
elsif($prop=~ /organization/i){ |
407
|
6
|
|
|
|
|
24
|
$person->setOrganization($val); |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
elsif($prop=~ /street1/i){ |
410
|
0
|
|
|
|
|
0
|
$person->setStreet($val); |
411
|
0
|
|
|
|
|
0
|
next; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
elsif($prop=~ /street2/i){ |
414
|
0
|
|
|
|
|
0
|
$val=$person->getStreet()."\n$val"; |
415
|
0
|
|
|
|
|
0
|
$person->setStreet($val); |
416
|
0
|
|
|
|
|
0
|
next; |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
elsif($prop=~ /city/i){ |
419
|
6
|
|
|
|
|
28
|
$person->setCity($val); |
420
|
6
|
|
|
|
|
26
|
next; |
421
|
|
|
|
|
|
|
} |
422
|
|
|
|
|
|
|
elsif($prop=~ /code/i){ |
423
|
6
|
|
|
|
|
27
|
$person->setPostalCode("$val"); |
424
|
6
|
|
|
|
|
14
|
next; |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
elsif($prop=~ /country/i){ |
427
|
6
|
|
|
|
|
25
|
$person->setCountry($val); |
428
|
6
|
|
|
|
|
14
|
next; |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
elsif($prop=~ /phone/i){ |
431
|
6
|
|
|
|
|
32
|
$person->setPhone($val); |
432
|
6
|
|
|
|
|
13
|
next; |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
elsif($prop=~ /email/i){ |
435
|
6
|
|
|
|
|
26
|
$person->setEmail($val); |
436
|
6
|
|
|
|
|
13
|
next; |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
elsif($line=~ /name\s+server:(\S+\s+)/i){ |
440
|
16
|
|
|
|
|
42
|
$self->addNameServer($1); |
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
elsif($line=~ /expiration\s+date:(.*)/i){ |
443
|
0
|
|
|
|
|
0
|
$self->setExpirationDate($self->sanitizeDate($1)); |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
elsif($line=~ /last\s+updated\s+\S+:(.*)/i){ |
446
|
0
|
|
|
|
|
0
|
$self->setLastUpdated($self->sanitizeDate($1)); |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
# Will implement .biz here |
450
|
|
|
|
|
|
|
elsif($self->{domain}=~ /.biz$/) { |
451
|
|
|
|
|
|
|
|
452
|
0
|
0
|
|
|
|
0
|
if($line=~ /NOT\s+FOUND/i){ |
453
|
0
|
|
|
|
|
0
|
return 0; |
454
|
|
|
|
|
|
|
} |
455
|
0
|
0
|
0
|
|
|
0
|
if($line=~ /^Bill/ or $line=~ /^Admin/ or $line=~ /^Tech/ or $line=~ /^Registrant/){ |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
456
|
0
|
|
|
|
|
0
|
$line=~ s/Contact//; |
457
|
0
|
|
|
|
|
0
|
$line=~ /(\S+)(\s+\S+){1,2}:\s+((\S+\s+)+)/; |
458
|
|
|
|
|
|
|
#check if person object exists and get handle |
459
|
0
|
|
|
|
|
0
|
my $key=$1; |
460
|
0
|
|
|
|
|
0
|
my $prop=$2; |
461
|
0
|
|
|
|
|
0
|
my $val=$3; |
462
|
0
|
|
|
|
|
0
|
chomp $val; |
463
|
0
|
|
|
|
|
0
|
$key=~ s/ing|nical|istrative//; |
464
|
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
0
|
$key=lc($key); |
466
|
0
|
|
|
|
|
0
|
my $person; |
467
|
0
|
0
|
|
|
|
0
|
if($self->getPerson($key)){ |
468
|
0
|
|
|
|
|
0
|
$person=$self->getPerson($key); |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
else{ |
471
|
0
|
|
|
|
|
0
|
$person=new Net::WhoisNG::Person(); |
472
|
0
|
|
|
|
|
0
|
$self->addPerson($person,$key); |
473
|
|
|
|
|
|
|
} |
474
|
0
|
0
|
|
|
|
0
|
if($prop=~ /ID:/){ |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
475
|
0
|
|
|
|
|
0
|
$person->setID($val); |
476
|
0
|
|
|
|
|
0
|
next; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
elsif($prop=~ /name/i){ |
479
|
0
|
|
|
|
|
0
|
$person->setName($val); |
480
|
0
|
|
|
|
|
0
|
next; |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
elsif($prop=~ /organization/i){ |
483
|
0
|
|
|
|
|
0
|
$person->setOrganization($val); |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
elsif($prop=~ /address1/i){ |
486
|
0
|
|
|
|
|
0
|
$person->setStreet($val); |
487
|
0
|
|
|
|
|
0
|
next; |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
elsif($prop=~ /address2/i){ |
490
|
0
|
|
|
|
|
0
|
$val=$person->getStreet()."\n$val"; |
491
|
0
|
|
|
|
|
0
|
$person->setStreet($val); |
492
|
0
|
|
|
|
|
0
|
next; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
elsif($prop=~ /city/i){ |
495
|
0
|
|
|
|
|
0
|
$person->setCity($val); |
496
|
0
|
|
|
|
|
0
|
next; |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
elsif($line=~ /postal\s+code/i){ |
499
|
0
|
|
|
|
|
0
|
$person->setPostalCode($val); |
500
|
0
|
|
|
|
|
0
|
next; |
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
elsif($prop=~ /country/i){ |
503
|
0
|
|
|
|
|
0
|
$person->setCountry($val); |
504
|
0
|
|
|
|
|
0
|
next; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
elsif($line=~ /phone\s+number/i){ |
507
|
0
|
|
|
|
|
0
|
$person->setPhone($val); |
508
|
0
|
|
|
|
|
0
|
next; |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
elsif($prop=~ /email/i){ |
511
|
0
|
|
|
|
|
0
|
$person->setEmail($val); |
512
|
0
|
|
|
|
|
0
|
next; |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
elsif($line=~ /name\s+server:\s+(\S+\s+)/i){ |
516
|
0
|
|
|
|
|
0
|
$self->addNameServer($1); |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
#Tue Oct 28 16:05:56 GMT+00:00 2003 |
519
|
|
|
|
|
|
|
elsif($line=~ /expiration\s+date:\s+((\S+\s+)+){1,6}/i){ |
520
|
0
|
|
|
|
|
0
|
$self->setExpirationDate($self->sanitizeDate($1)); |
521
|
|
|
|
|
|
|
} |
522
|
|
|
|
|
|
|
elsif($line=~ /last\s+updated\s+date:\s+((\S+\s+)+){1,6}/i){ |
523
|
0
|
|
|
|
|
0
|
$self->setLastUpdated($self->sanitizeDate($1)); |
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
else{ |
527
|
0
|
|
|
|
|
0
|
print "Parsing for $self->{domain} TLD not yet implemented\n"; |
528
|
0
|
|
|
|
|
0
|
return 0; |
529
|
|
|
|
|
|
|
} |
530
|
|
|
|
|
|
|
} |
531
|
2
|
|
|
|
|
27
|
return 1; |
532
|
|
|
|
|
|
|
} |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
sub sanitizeDate{ |
535
|
|
|
|
|
|
|
# we need to set a consistent date output format. We want something we can manipulate. mmm-dd-yyyy |
536
|
|
|
|
|
|
|
# Tue, Apr 17, 2001 |
537
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
538
|
0
|
|
|
|
|
0
|
my $raw_date=shift; |
539
|
|
|
|
|
|
|
#print "Raw date recieved: $raw_date\n"; |
540
|
0
|
0
|
|
|
|
0
|
if($raw_date=~ /(\d{1,2})-(\w\w\w)-(\d\d\d\d)/){ |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
541
|
0
|
|
|
|
|
0
|
return "$2-$1-$3"; |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
elsif($raw_date=~ /(\d\d\d\d)-(\w\w\w)-(\d\d$)/){ |
544
|
0
|
|
|
|
|
0
|
return "$2-$3-$1"; |
545
|
|
|
|
|
|
|
} |
546
|
|
|
|
|
|
|
elsif($raw_date=~ /(\d\d\d\d)-(\w\w\w)-(\d\d).$/){ |
547
|
0
|
|
|
|
|
0
|
return "$2-$3-$1"; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
elsif($raw_date=~ /\w\w\w,\s+(\S+)\s+(\d{1,2}),\s+(\d\d\d\d)/){ |
550
|
0
|
|
|
|
|
0
|
return "$1-$2-$3"; |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
elsif($raw_date=~ /(\d{1,2})-(\w\w\w)-(\d\d)/){ |
553
|
0
|
|
|
|
|
0
|
return "$2-$1-20$3"; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
elsif($raw_date=~ /((\S+\s+)+){1,6}/){ |
556
|
0
|
|
|
|
|
0
|
my @tmp=split(/\s+/,$raw_date); |
557
|
0
|
|
|
|
|
0
|
return $tmp[1]."-".$tmp[2]."-".$tmp[5]; |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
#Wed Sep 05 23:59:59 GMT 2007 |
560
|
|
|
|
|
|
|
elsif($raw_date =~ /\w\w\w\s+(\w\w\w)\s+(\d{1,2})\S+\s+\w\w\w\s+(\d{4})/){ |
561
|
0
|
|
|
|
|
0
|
return "$1-$2-$3"; |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
} |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
sub getLastUpdated{ |
566
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
567
|
0
|
|
|
|
|
0
|
return $self->{lastupdated}; |
568
|
|
|
|
|
|
|
} |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
sub setLastUpdated{ |
571
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
572
|
0
|
|
|
|
|
0
|
$self->{lastupdated}=shift; |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
sub getDomainName{ |
576
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
577
|
0
|
|
|
|
|
0
|
return $self->{domain}; |
578
|
|
|
|
|
|
|
} |
579
|
|
|
|
|
|
|
|
580
|
0
|
|
|
0
|
0
|
0
|
sub getSponsor{ |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
0
|
|
|
0
|
0
|
0
|
sub setSponsor{ |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
sub getRegistrar{ |
587
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
588
|
0
|
|
|
|
|
0
|
return $self->{registrar}; |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
sub setRegistrar{ |
592
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
593
|
0
|
|
|
|
|
0
|
$self->{registrar}=shift; |
594
|
|
|
|
|
|
|
} |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
sub getExpirationDate{ |
597
|
2
|
|
|
2
|
0
|
5
|
my $self=shift; |
598
|
2
|
|
|
|
|
8
|
return $self->{expirationdate}; |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
sub setExpirationDate{ |
602
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
603
|
0
|
|
|
|
|
0
|
$self->{expirationdate}=shift; |
604
|
|
|
|
|
|
|
} |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
sub setCreatedDate{ |
607
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
608
|
0
|
|
|
|
|
0
|
$self->{createddate}=shift; |
609
|
|
|
|
|
|
|
} |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
sub getCreatedDate{ |
612
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
613
|
0
|
|
|
|
|
0
|
return $self->{createddate}; |
614
|
|
|
|
|
|
|
} |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
sub getStatus{ |
617
|
1
|
|
|
1
|
0
|
254
|
my $self=shift; |
618
|
1
|
50
|
|
|
|
7
|
if(defined($self->{status})){ |
619
|
0
|
|
|
|
|
0
|
return $self->{status}; |
620
|
|
|
|
|
|
|
} |
621
|
1
|
|
|
|
|
16
|
my %months=(jan=>1, feb=>2, mar=>3, apr=>4, may=>5, jun=>6, jul=>7, aug=>8, sep=>9, oct=>10, nov=>11, dec=>12); |
622
|
1
|
|
|
|
|
4
|
my $exp=$self->getExpirationDate(); |
623
|
1
|
50
|
|
|
|
9
|
return 0 unless defined($exp); |
624
|
0
|
|
|
|
|
0
|
my ($emonth,$eday,$eyear)=split(/-/,$exp); |
625
|
0
|
|
|
|
|
0
|
$emonth=$months{lc($emonth)}; |
626
|
0
|
0
|
|
|
|
0
|
if(length($emonth)==1){ |
627
|
0
|
|
|
|
|
0
|
$emonth="0$emonth"; |
628
|
|
|
|
|
|
|
} |
629
|
0
|
|
|
|
|
0
|
$exp=$eyear.$emonth.$eday; |
630
|
0
|
|
|
|
|
0
|
my @now=localtime(); |
631
|
0
|
|
|
|
|
0
|
my $cyear=$now[5]; |
632
|
0
|
|
|
|
|
0
|
$cyear=$cyear+1900; |
633
|
0
|
|
|
|
|
0
|
my $cmonth=$now[4]; |
634
|
0
|
0
|
|
|
|
0
|
if(length($cmonth)==1){ |
635
|
0
|
|
|
|
|
0
|
$cmonth="0$cmonth"; |
636
|
|
|
|
|
|
|
} |
637
|
0
|
|
|
|
|
0
|
my $cday=$now[3]; |
638
|
0
|
0
|
|
|
|
0
|
if(length($cday)==1){ |
639
|
0
|
|
|
|
|
0
|
$cday="0$cday"; |
640
|
|
|
|
|
|
|
} |
641
|
0
|
|
|
|
|
0
|
my $cur=$cyear.$cmonth.$cday; |
642
|
0
|
|
|
|
|
0
|
my $status=$exp-$cur; |
643
|
0
|
0
|
|
|
|
0
|
if($status>=0){ |
644
|
0
|
|
|
|
|
0
|
return 1; |
645
|
|
|
|
|
|
|
} |
646
|
0
|
|
|
|
|
0
|
return 0; |
647
|
|
|
|
|
|
|
} |
648
|
|
|
|
|
|
|
|
649
|
0
|
|
|
0
|
0
|
0
|
sub setStatus{ |
650
|
|
|
|
|
|
|
} |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub getPerson{ |
653
|
156
|
|
|
156
|
0
|
3439
|
my $self=shift; |
654
|
156
|
|
|
|
|
238
|
my $type=shift; |
655
|
156
|
|
|
|
|
219
|
my $t_people=$self->{people}; |
656
|
156
|
|
|
|
|
163
|
my %people; |
657
|
156
|
100
|
|
|
|
309
|
if(defined($t_people)){ |
658
|
155
|
|
|
|
|
533
|
%people=%$t_people; |
659
|
155
|
|
|
|
|
512
|
return $people{$type}; |
660
|
|
|
|
|
|
|
} |
661
|
1
|
|
|
|
|
4
|
return undef; |
662
|
|
|
|
|
|
|
} |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
sub addPerson{ |
665
|
3
|
|
|
3
|
0
|
44
|
my $self=shift; |
666
|
3
|
|
|
|
|
3
|
my $person=shift; |
667
|
3
|
|
|
|
|
6
|
my $type=shift; |
668
|
|
|
|
|
|
|
#print "Adding $type #####\n"; |
669
|
3
|
|
|
|
|
11
|
my %people; |
670
|
3
|
100
|
|
|
|
11
|
if($self->{people}){ |
671
|
2
|
|
|
|
|
4
|
my $t_people=$self->{people}; |
672
|
2
|
|
|
|
|
7
|
%people=%$t_people; |
673
|
|
|
|
|
|
|
} |
674
|
3
|
|
|
|
|
8
|
$people{$type}=$person; |
675
|
3
|
|
|
|
|
9
|
$self->{people}=\%people; |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
sub addNameServer{ |
679
|
16
|
|
|
16
|
0
|
23
|
my $self=shift; |
680
|
16
|
|
|
|
|
33
|
my $svr=shift; |
681
|
|
|
|
|
|
|
#chomp $svr; |
682
|
16
|
|
|
|
|
46
|
$svr=~ s/\r\n//g; |
683
|
16
|
|
|
|
|
28
|
$svr=~ s/\n//g; |
684
|
16
|
|
|
|
|
20
|
$svr=~ s/\r//g; |
685
|
16
|
|
|
|
|
30
|
$svr =~ s/\s+//g; |
686
|
16
|
|
|
|
|
34
|
$svr = lc($svr); |
687
|
16
|
|
|
|
|
22
|
my @ns; |
688
|
|
|
|
|
|
|
|
689
|
16
|
100
|
|
|
|
41
|
if(defined($self->{nameservers})){ |
690
|
14
|
|
|
|
|
21
|
my $t_ns=$self->{nameservers}; |
691
|
14
|
|
|
|
|
41
|
@ns=@$t_ns; |
692
|
|
|
|
|
|
|
} |
693
|
16
|
|
|
|
|
75
|
push(@ns, $svr); |
694
|
16
|
|
|
|
|
64
|
$self->{nameservers}=\@ns; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
sub getNameServers{ |
698
|
2
|
|
|
2
|
0
|
5
|
my $self=shift; |
699
|
2
|
|
|
|
|
8
|
my $ns = $self->{nameservers}; |
700
|
2
|
|
|
|
|
11
|
my @resp = @$ns; |
701
|
2
|
|
|
|
|
14
|
map(chomp, @resp); |
702
|
2
|
|
|
|
|
10
|
map(lc, @resp); |
703
|
2
|
|
|
|
|
13
|
map(s/\s+//g, @resp); |
704
|
2
|
|
|
|
|
11
|
return \@resp; |
705
|
|
|
|
|
|
|
} |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
sub toXML{ |
708
|
0
|
|
|
0
|
0
|
|
require XML::Simple; |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
|
my $self = shift; |
711
|
|
|
|
|
|
|
|
712
|
0
|
0
|
|
|
|
|
my $xml = XML::Simple->new(suppressempty=>'',XMLDecl => 1, NoAttr => 1) or return undef; |
713
|
|
|
|
|
|
|
|
714
|
0
|
|
|
|
|
|
my $tree = (); |
715
|
0
|
|
|
|
|
|
$tree->{'domain_name'} = $self->{'domain'}; |
716
|
0
|
|
|
|
|
|
my $people = $self->{"people"}; |
717
|
0
|
|
|
|
|
|
my %contacts = %$people; |
718
|
0
|
|
|
|
|
|
my @rawcontacts; |
719
|
0
|
|
|
|
|
|
my $raw = 0; |
720
|
|
|
|
|
|
|
|
721
|
0
|
|
|
|
|
|
foreach my $key(keys(%$people)){ |
722
|
0
|
|
|
|
|
|
my $val = $contacts{$key}; |
723
|
0
|
|
|
|
|
|
my $hash = $val->getRawHash(); |
724
|
0
|
0
|
|
|
|
|
if(defined($hash)){ |
725
|
0
|
|
|
|
|
|
$hash->{'parsed'} = "1"; |
726
|
0
|
|
|
|
|
|
$hash->{'type'} = $key; |
727
|
0
|
|
|
|
|
|
push(@rawcontacts, $hash); |
728
|
|
|
|
|
|
|
} |
729
|
|
|
|
|
|
|
else{ |
730
|
0
|
|
|
|
|
|
$raw = 1; |
731
|
0
|
|
|
|
|
|
my $line = (); |
732
|
0
|
|
|
|
|
|
$line->{'detail'}=$val->getCredentials(); |
733
|
0
|
|
|
|
|
|
$line->{'type'} = $key; |
734
|
0
|
|
|
|
|
|
$line->{'parsed'} = 0; |
735
|
0
|
|
|
|
|
|
push(@rawcontacts, $line); |
736
|
|
|
|
|
|
|
} |
737
|
|
|
|
|
|
|
} |
738
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
|
$tree->{"contact"}=\@rawcontacts; |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
|
742
|
0
|
|
|
|
|
|
$tree->{"name_server"} = $self->getNameServers(); |
743
|
|
|
|
|
|
|
|
744
|
0
|
|
|
|
|
|
$tree->{status} = $self->getStatus(); |
745
|
0
|
|
|
|
|
|
$tree->{"expiration_date"} = $self->{'expirationdate'}; |
746
|
0
|
|
|
|
|
|
$tree->{"last_updated_date"} = $self->{"lastupdated"}; |
747
|
0
|
0
|
|
|
|
|
$tree->{"created_date"} = $self->{"createddate"} if defined($self->{"createddate"}); |
748
|
|
|
|
|
|
|
|
749
|
0
|
|
|
|
|
|
return $xml->XMLout($tree); |
750
|
|
|
|
|
|
|
} |
751
|
|
|
|
|
|
|
|
752
|
0
|
|
|
0
|
0
|
|
sub parseUK{ |
753
|
|
|
|
|
|
|
} |
754
|
|
|
|
|
|
|
|
755
|
0
|
|
|
0
|
0
|
|
sub expired{ |
756
|
|
|
|
|
|
|
} |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
sub lookup{ |
759
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
760
|
0
|
|
|
|
|
|
return $self->lookUp(); |
761
|
|
|
|
|
|
|
} |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
1; |
764
|
|
|
|
|
|
|
__END__ |