| 1 | package Net::Whois::Raw::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | $Net::Whois::Raw::Common::VERSION = '2.99044'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Helper for Net::Whois::Raw. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Regexp::IPv6 qw($IPv6_re); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Net::Whois::Raw::Data (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Net::Whois::Raw (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # func prototype | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | sub untaint(\$); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # get whois from cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | sub get_from_cache { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_from_cache: called CC=10 SCAR=23.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | my ($query, $cache_dir, $cache_time) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | return undef unless $cache_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | mkdir $cache_dir unless -d $cache_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | my $now = time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # clear the cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | foreach my $fn ( glob("$cache_dir/*") ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | my $mtime = ( stat($fn) )[9] or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | my $elapsed = $now - $mtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | untaint $fn; untaint $elapsed; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | unlink $fn if ( $elapsed / 60 >= $cache_time ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | ▶ | if ( -e "$cache_dir/$query.00" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | my $level = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ▶ | while ( open( my $cache_fh, '<', "$cache_dir/$query.".sprintf( "%02d", $level ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | $result->[$level]->{srv} = <$cache_fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | chomp $result->[$level]->{srv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | $result->[$level]->{text} = join "", <$cache_fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | if ( !$result->[$level]->{text} and $Net::Whois::Raw::CHECK_FAIL ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $result->[$level]{"text"} and $Net::Whois::Raw::CHECK_FAIL
MC/DC0%0/2
not $result->[$level]{"text"} and $Net::Whois::Raw::CHECK_FAIL
not $result->[$level]{"text"}
$Net::Whois::Raw::CHECK_FAIL
Truth table33%1/3
not(A) and B
A= not $result->[$level]{"text"}B= $Net::Whois::Raw::CHECK_FAIL
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $result->[$level]->{text} = undef ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 5 | $result->[$level]->{text} = decode_utf8( $result->[$level]->{text} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 5 | $level++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 5 | close $cache_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 3 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # write whois to cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | ▶ | sub write_to_cache { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_to_cache: called CC=13 SCAR=28.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | my ($query, $result, $cache_dir) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 2 | ▶ | return unless $cache_dir && $result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cache_dir and $result
MC/DC0%0/2
$cache_dir and $result
$cache_dir
$result
Truth table33%1/3
A and B
A= $cache_dirB= $result
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | ▶ | mkdir $cache_dir unless -d $cache_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | untaint $query; untaint $cache_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | my $level = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | foreach my $res ( @{$result} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 5 | ▶ | local $res->{text} = $res->{whois} if not exists $res->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 5 | ▶ | next if defined $res->{text} && !$res->{text} || !defined $res->{text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $res->{"text"} and not $res->{"text"} or not defined $res->{"text"}
defined $res->{"text"} and not $res->{"text"}
MC/DC0%0/3
defined $res->{"text"} and not $res->{"text"} or not defined $res->{"text"}
defined $res->{"text"}
not $res->{"text"}
not defined $res->{"text"}
Truth table20%1/5
A and not(B) or not(C)
A= defined $res->{"text"}B= not $res->{"text"}C= not defined $res->{"text"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 5 | my $enc_text = $res->{text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 5 | utf8::encode( $enc_text ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 5 | my $postfix = sprintf("%02d", $level); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 5 | ▶ | if ( open( my $cache_fh, '>', "$cache_dir/$query.$postfix" ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | print $cache_fh $res->{srv} ? $res->{srv} : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 5 | ▶ | ( $res->{server} ? $res->{server} : '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | , "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 5 | ▶ | print $cache_fh $enc_text ? $enc_text : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 5 | close $cache_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 5 | chmod 0666, "$cache_dir/$query.$postfix"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 5 | $level++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # remove copyright messages, check for existance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | sub process_whois { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_whois: called CC=19 SCAR=49.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | my ( $query, $server, $whois, $CHECK_FAIL, $OMIT_MSG, $CHECK_EXCEED ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | $server = lc $server; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | my ( $name, $tld ) = split_domain( $query ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # use string as is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 4 | ▶ | no utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | ▶ | if ( $CHECK_EXCEED ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $exceed = $Net::Whois::Raw::Data::exceed{ $server }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | if ( $exceed && $whois =~ /$exceed/s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$exceed and $whois =~ /$exceed/s
MC/DC0%0/2
$exceed and $whois =~ /$exceed/s
$exceed
$whois =~ /$exceed/s
Truth table0%0/3
A and B
A= $exceedB= $whois =~ /$exceed/s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $whois, 'Connection rate exceeded'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | $whois = _strip_trailer_lines( $whois ) if $OMIT_MSG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | ▶ | if ( $CHECK_FAIL || $OMIT_MSG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$CHECK_FAIL or $OMIT_MSG
MC/DC0%0/2
$CHECK_FAIL or $OMIT_MSG
$CHECK_FAIL
$OMIT_MSG
Truth table33%1/3
A or B
A= $CHECK_FAILB= $OMIT_MSG
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $notfound = $Net::Whois::Raw::Data::notfound{ $server }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $strip = $Net::Whois::Raw::Data::strip{ $server }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my @strip = $strip ? @$strip : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my @lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | MAIN: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | for ( split /\n/, $whois ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if ( $CHECK_FAIL && $notfound && /$notfound/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$CHECK_FAIL and $notfound and /$notfound/
$CHECK_FAIL and $notfound
MC/DC0%0/3
$CHECK_FAIL and $notfound and /$notfound/
$CHECK_FAIL
$notfound
/$notfound/
Truth table0%0/4
A and B and C
A= $CHECK_FAILB= $notfoundC= /$notfound/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return undef, "Not found"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ( $OMIT_MSG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | for my $re ( @strip ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | next MAIN if /$re/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | push @lines, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $whois = join "\n", @lines, ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if ( $OMIT_MSG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $whois =~ s/(?:\s*\n)+$/\n/s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $whois =~ s/^\n+//s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $whois =~ s|\n{3,}|\n\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | ▶ | if ( defined $Net::Whois::Raw::Data::postprocess{ $server } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $whois = $Net::Whois::Raw::Data::postprocess{ $server }->( $whois ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | if ( defined $Net::Whois::Raw::POSTPROCESS{ $server } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $whois = $Net::Whois::Raw::POSTPROCESS{ $server }->( $whois ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | ▶ | if ( defined $Net::Whois::Raw::Data::codepages{ $server } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $whois = decode( $Net::Whois::Raw::Data::codepages{ $server }, $whois ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | utf8::decode( $whois ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | return $whois, undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Tries to strip trailer lines of whois | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 3 | ▶ | sub _strip_trailer_lines { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_strip_trailer_lines: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | my ( $whois ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | for my $re ( @Net::Whois::Raw::Data::strip_regexps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | $whois =~ s/$re//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | return $whois; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # get whois-server for domain / tld | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 6 | ▶ | sub get_server { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_server: called CC=6 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 6 | my ( $dom, $is_ns, $tld ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 6 | ▶ | $tld ||= get_dom_tld( $dom ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tld ||= get_dom_tld($dom)
MC/DC0%0/2
$tld ||= get_dom_tld($dom)
$tld
get_dom_tld($dom)
Truth table66%2/3
A ||= B
A= $tldB= get_dom_tld($dom)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 6 | $tld = uc $tld; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 6 | ▶ | if ( grep { $_ eq $tld } @Net::Whois::Raw::Data::www_whois ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | return 'www_whois'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | ▶ | if ( $is_ns ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | return $Net::Whois::Raw::Data::servers{ $tld . '.NS' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | || $Net::Whois::Raw::Data::servers{ 'NS' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$Net::Whois::Raw::Data::servers{$tld . '.NS'} || $Net::Whois::Raw::Data::servers{'NS'}
MC/DC0%0/2
$Net::Whois::Raw::Data::servers{$tld . '.NS'} || $Net::Whois::Raw::Data::servers{'NS'}
$Net::Whois::Raw::Data::servers{$tld . '.NS'}
$Net::Whois::Raw::Data::servers{'NS'}
Truth table0%0/3
A || B
A= $Net::Whois::Raw::Data::servers{$tld . '.NS'}B= $Net::Whois::Raw::Data::servers{'NS'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | ▶ | return lc( $Net::Whois::Raw::Data::servers{ $tld } || "whois.nic.$tld" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Net::Whois::Raw::Data::servers{$tld} || "whois.nic.$tld"
MC/DC0%0/1
$Net::Whois::Raw::Data::servers{$tld} || "whois.nic.$tld"
$Net::Whois::Raw::Data::servers{$tld}
Truth table50%1/2
A
A= $Net::Whois::Raw::Data::servers{$tld}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 6 | ▶ | sub get_real_whois_query{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_real_whois_query: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 6 | my ( $whoisquery, $srv, $is_ns ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 6 | ▶ | $srv .= '.ns' if $is_ns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | ▶ | if ( $srv eq 'whois.crsnic.net' && domain_level( $whoisquery ) == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$srv eq "whois.crsnic.net" and domain_level($whoisquery) == 2
MC/DC50%1/2
$srv eq "whois.crsnic.net" and domain_level($whoisquery) == 2
$srv eq "whois.crsnic.net"
domain_level($whoisquery) == 2
Truth table66%2/3
A and B
A= $srv eq "whois.crsnic.net"B= domain_level($whoisquery) == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 2 | return "domain $whoisquery"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | elsif ( $Net::Whois::Raw::Data::query_prefix{ $srv } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | return $Net::Whois::Raw::Data::query_prefix{ $srv } . $whoisquery; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | return $whoisquery; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # get domain TLD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 16 | ▶ | sub get_dom_tld { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_dom_tld: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 16 | my ($dom) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 16 | my $tld; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 16 | ▶ | if ( is_ipaddr($dom) || is_ip6addr($dom) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
is_ipaddr($dom) or is_ip6addr($dom)
MC/DC50%1/2
is_ipaddr($dom) or is_ip6addr($dom)
is_ipaddr($dom)
is_ip6addr($dom)
Truth table66%2/3
A or B
A= is_ipaddr($dom)B= is_ip6addr($dom)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | $tld = "IP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | elsif ( domain_level($dom) == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | $tld = "NOTLD"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 14 | my @tokens = split( /\./, $dom ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # try to get the longest known tld for this domain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 14 | for my $i ( 1..$#tokens ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 14 | my $tld_try = join '.', @tokens[$i..$#tokens]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 14 | ▶ | if ( exists $Net::Whois::Raw::Data::servers{ uc $tld_try } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 13 | $tld = $tld_try; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 13 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 14 | ▶ | $tld = $tokens[-1] unless $tld; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 16 | return $tld; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # get URL for query via HTTP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # %param: domain* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | sub get_http_query_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_http_query_url: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my ($domain) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my ($name, $tld) = split_domain($domain); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my @http_query_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | # my ($url, %form); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if ($tld eq 'ru' || $tld eq 'su') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
Condition0%0/3
$tld eq "ru" or $tld eq "su"
MC/DC0%0/2
$tld eq "ru" or $tld eq "su"
$tld eq "ru"
$tld eq "su"
Truth table0%0/3
A or B
A= $tld eq "ru"B= $tld eq "su"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | url => "http://www.nic.ru/whois/?domain=$name.$tld", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | form => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | elsif ($tld eq 'ip') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | url => "http://www.nic.ru/whois/?ip=$name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | form => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | elsif ($tld eq 'ws') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | url => "http://worldsite.ws/utilities/lookup.dhtml?domain=$name&tld=$tld", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | form => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | elsif ($tld eq 'kz') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | url => "http://www.nic.kz/cgi-bin/whois?query=$name.$tld&x=0&y=0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | form => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | elsif ($tld eq 'vn') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # VN doesn't have web whois at the moment... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | url => "http://www.tenmien.vn/jsp/jsp/tracuudomain1.jsp", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | form => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | cap2 => ".$tld", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | referer => 'http://www.vnnic.vn/english/', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | domainname1 => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | elsif ($tld eq 'ac') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | url => "http://nic.ac/cgi-bin/whois?query=$name.$tld", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | form => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | elsif ($tld eq 'bz') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | url => "http://www.test.bz/Whois/index.php?query=$name&output=nice&dotname=.$tld&whois=Search", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | elsif ($tld eq 'tj') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | #my $data = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # url => "http://get.tj/whois/?lang=en&domain=$domain", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # from => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | #push @http_query_data, $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # first level on nic.tj | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | #$data = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # url => "http://www.nic.tj/cgi/lookup2?domain=$name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # from => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | #push @http_query_data, $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # second level on nic.tj | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $data = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | url => "http://www.nic.tj/cgi/whois?domain=$name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | from => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | push @http_query_data, $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | #$data = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # url => "http://ns1.nic.tj/cgi/whois?domain=$name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # from => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | #push @http_query_data, $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | #$data = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # url => "http://62.122.137.16/cgi/whois?domain=$name", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # from => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | #push @http_query_data, $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # return $url, %form; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return \@http_query_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub have_reserve_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_reserve_url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my ( $tld ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my %tld_list = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 'tj' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return defined $tld_list{$tld}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # Parse content received from HTTP server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # %param: resp*, tld* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | sub parse_www_content { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_www_content: called CC=35 SCAR=64.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | my ($resp, $tld, $url, $CHECK_EXCEED) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | chomp $resp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | $resp =~ s/\r//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | my $ishtml; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 1 | ▶ | if ( $tld eq 'ru' || $tld eq 'su' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
Condition33%1/3
$tld eq "ru" or $tld eq "su"
MC/DC0%0/2
$tld eq "ru" or $tld eq "su"
$tld eq "ru"
$tld eq "su"
Truth table33%1/3
A or B
A= $tld eq "ru"B= $tld eq "su"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $resp = decode( 'koi8-r', $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | (undef, $resp) = split('<script>.*?</script>',$resp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ($resp) = split('</td></tr></table>', $resp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $resp =~ s/ / /gi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $resp =~ s/<([^>]|\n)*>//gi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | return 0 if $resp=~ m/Доменное имя .*? не зарегистрировано/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | $resp = 'ERROR' if $resp =~ m/Error:/i || $resp !~ m/Информация о домене .+? \(по данным WHOIS.RIPN.NET\):/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$resp =~ /Error:/i or not $resp =~ /\x{418}\x{43d}\x{444}\x{43e}\x{440}\x{43c}\x{430}\x{446}\x{438}\x{44f} \x{43e} \x{434}\x{43e}\x{43c}\x{435}\x{43d}\x{435} .+? \(\x{43f}\x{43e} \x{434}\x{430}\x{43d}\x{43d}\x{44b}\x{43c} WHOIS.RIPN.NET\):/
MC/DC0%0/2
$resp =~ /Error:/i or not $resp =~ /\x{418}\x{43d}\x{444}\x{43e}\x{440}\x{43c}\x{430}\x{446}\x{438}\x{44f} \x{43e} \x{434}\x{43e}\x{43c}\x{435}\x{43d}\x{435} .+? \(\x{43f}\x{43e} \x{434}\x{430}\x{43d}\x{43d}\x{44b}\x{43c} WHOIS.RIPN.NET\):/
$resp =~ /Error:/i
not $resp =~ /\x{418}\x{43d}\x{444}\x{43e}\x{440}\x{43c}\x{430}\x{446}\x{438}\x{44f} \x{43e} \x{434}\x{43e}\x{43c}\x{435}\x{43d}\x{435} .+? \(\x{43f}\x{43e} \x{434}\x{430}\x{43d}\x{43d}\x{44b}\x{43c} WHOIS.RIPN.NET\):/
Truth table0%0/3
A or not(B)
A= $resp =~ /Error:/iB= not $resp =~ /\x{418}\x{43d}\x{444}\x{43e}\x{440}\x{43c}\x{430}\x{446}\x{438}\x{44f} \x{43e} \x{434}\x{43e}\x{43c}\x{435}\x{43d}\x{435} .+? \(\x{43f}\x{43e} \x{434}\x{430}\x{43d}\x{43d}\x{44b}\x{43c} WHOIS.RIPN.NET\):/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | #TODO: errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | elsif ($tld eq 'ip') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | return 0 unless $resp =~ m|<p ID="whois">(.+?)</p>|s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $resp =~ s|<a.+?>||g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $resp =~ s|</a>||g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $resp =~ s|<br>||g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $resp =~ s| | |g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | elsif ($tld eq 'ws') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | if ($resp =~ /Whois information for .+?:(.+?)<table>/s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $resp =~ s|<font.+?>||isg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $resp =~ s|</font>||isg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $ishtml = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | elsif ($tld eq 'kz') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if ($resp =~ /Domain Name\.{10}/s && $resp =~ /<pre>(.+?)<\/pre>/s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$resp =~ /Domain Name\.{10}/s and $resp =~ m[<pre>(.+?)</pre>]s
MC/DC0%0/2
$resp =~ /Domain Name\.{10}/s and $resp =~ m[<pre>(.+?)</pre>]s
$resp =~ /Domain Name\.{10}/s
$resp =~ m[<pre>(.+?)</pre>]s
Truth table0%0/3
A and B
A= $resp =~ /Domain Name\.{10}/sB= $resp =~ m[<pre>(.+?)</pre>]s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | elsif ($tld eq 'vn') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if ($resp =~ /\(\s*?(Domain .+?:\s*registered)\s*?\)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # if ($resp =~/#ENGLISH.*?<\/tr>(.+?)<\/table>/si) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # $resp = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # $resp =~ s|</?font.*?>||ig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # $resp =~ s| ||ig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # $resp =~ s|<br>|\n|ig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # $resp =~ s|<tr>\s*<td.*?>\s*(.*?)\s*</td>\s*<td.*?>\s*(.*?)\s*</td>\s*</tr>|$1 $2\n|isg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # $resp =~ s|^\s*||mg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | elsif ($tld eq 'ac') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if ($CHECK_EXCEED && $resp =~ /too many requests/is) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$CHECK_EXCEED and $resp =~ /too many requests/is
MC/DC0%0/2
$CHECK_EXCEED and $resp =~ /too many requests/is
$CHECK_EXCEED
$resp =~ /too many requests/is
Truth table0%0/3
A and B
A= $CHECK_EXCEEDB= $resp =~ /too many requests/is
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | die "Connection rate exceeded"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | elsif ($resp =~ /<!--- Start \/ Domain Info --->(.+?)<!--- End \/ Domain Info --->/is) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | $resp =~ s|</?table.*?>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $resp =~ s|</?b>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $resp =~ s|</?font.*?>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $resp =~ s|<tr.*?>\s*<td.*?>\s*(.*?)\s*</td>\s*<td.*?>\s*(.*?)\s*</td>\s*</tr>|$1 $2\n|isg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $resp =~ s|</?tr>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | $resp =~ s|</?td>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $resp =~ s|^\s*||mg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | elsif ($tld eq 'bz') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if ( $resp =~ m{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | <blockquote> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | (.+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | </blockquote> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | }xms ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if ( $resp =~ /NOT\s+FOUND/ || $resp =~ /No\s+Domain/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$resp =~ /NOT\s+FOUND/ or $resp =~ /No\s+Domain/
MC/DC0%0/2
$resp =~ /NOT\s+FOUND/ or $resp =~ /No\s+Domain/
$resp =~ /NOT\s+FOUND/
$resp =~ /No\s+Domain/
Truth table0%0/3
A or B
A= $resp =~ /NOT\s+FOUND/B= $resp =~ /No\s+Domain/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # Whois info not found | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $resp =~ s|<[^<>]+>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | ▶ | elsif ( $tld eq 'tj' && $url =~ m|^http\://get\.tj| ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$tld eq "tj" and $url =~ m[^http\://get\.tj]
MC/DC0%0/2
$tld eq "tj" and $url =~ m[^http\://get\.tj]
$tld eq "tj"
$url =~ m[^http\://get\.tj]
Truth table33%1/3
A and B
A= $tld eq "tj"B= $url =~ m[^http\://get\.tj]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if ($resp =~ m|<!-- Content //-->\n(.+?)<!-- End Content //-->|s ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $resp =~ s|<[^<>]+>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $resp =~ s|Whois\n|\n|s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | return 0 if $resp =~ m|Domain \S+ is free|s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $resp =~ s|Domain \S+ is already taken\.\n|\n|s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $resp =~ s| | |ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | $resp =~ s|«|"|ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $resp =~ s|»|"|ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $resp =~ s|\n\s+|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $resp =~ s|\s+\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $resp =~ s|\n\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ▶ | elsif ( $tld eq 'tj' && $url =~ m|\.nic\.tj/cgi/lookup| ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$tld eq "tj" and $url =~ m[\.nic\.tj/cgi/lookup]
MC/DC0%0/2
$tld eq "tj" and $url =~ m[\.nic\.tj/cgi/lookup]
$tld eq "tj"
$url =~ m[\.nic\.tj/cgi/lookup]
Truth table33%1/3
A and B
A= $tld eq "tj"B= $url =~ m[\.nic\.tj/cgi/lookup]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | if ($resp =~ m|<div[0-9a-z=\" ]*>\n?(.+?)\n?</div>|s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | return 0 if $resp =~ m|may be available|s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $resp =~ s|\n\s+|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $resp =~ s|\s+\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $resp =~ s|\n\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $resp =~ s|<br.+||si; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ▶ | elsif ( $tld eq 'tj' && $url =~ m|\.nic\.tj/cgi/whois| || $url =~ m|62\.122\.137\.16| ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$tld eq "tj" and $url =~ m[\.nic\.tj/cgi/whois] or $url =~ /62\.122\.137\.16/
$tld eq "tj" and $url =~ m[\.nic\.tj/cgi/whois]
MC/DC0%0/3
$tld eq "tj" and $url =~ m[\.nic\.tj/cgi/whois] or $url =~ /62\.122\.137\.16/
$tld eq "tj"
$url =~ m[\.nic\.tj/cgi/whois]
$url =~ /62\.122\.137\.16/
Truth table20%1/5
A and B or C
A= $tld eq "tj"B= $url =~ m[\.nic\.tj/cgi/whois]C= $url =~ /62\.122\.137\.16/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | $resp = decode_utf8( $resp ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | ▶ | if ( $resp =~ m{ <table [^>]*? > (.+) (:? </table> ) }sxmi ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | $resp = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | $resp =~ s|</?tr>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | $resp =~ s|<td>| |ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | $resp =~ s|</?td[0-9a-z=\" ]*>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 1 | $resp =~ s|</?col[0-9a-z=\" ]*>||ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 1 | $resp =~ s|«|"|ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 1 | $resp =~ s|»|"|ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 1 | $resp =~ s| | |ig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | $resp =~ s|\n\s+|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | $resp =~ s|\s+\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | $resp =~ s|\n\n|\n|sg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 1 | return $resp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # check, if it's IP-address? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 18 | ▶ | sub is_ipaddr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ipaddr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 18 | $_[0] =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # check, if it's IPv6-address? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 20 | ▶ | sub is_ip6addr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ip6addr: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 20 | my ( $ip ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 20 | ▶ | return 0 unless defined $ip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 20 | return $ip =~ /^$IPv6_re$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | # get domain level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 19 | ▶ | sub domain_level { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
domain_level: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 19 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 19 | my $dotcount = $str =~ tr/././; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 19 | return $dotcount + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # split domain on name and TLD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 7 | ▶ | sub split_domain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_domain: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 7 | my ($dom) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 7 | my $tld = get_dom_tld( $dom ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 7 | my $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 7 | ▶ | if (uc $tld eq 'IP' || $tld eq 'NOTLD') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
uc $tld eq "IP" or $tld eq "NOTLD"
MC/DC0%0/2
uc $tld eq "IP" or $tld eq "NOTLD"
uc $tld eq "IP"
$tld eq "NOTLD"
Truth table33%1/3
A or B
A= uc $tld eq "IP"B= $tld eq "NOTLD"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $name = $dom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 7 | $name = substr( $dom, 0, length($dom) - length($tld) - 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 7 | return ($name, $tld); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | sub dlen { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dlen: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return length($str) * domain_level($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # clear the data's taintedness | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 14 | ▶ | sub untaint (\$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
untaint: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 14 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 14 | $$str =~ m/^(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 14 | $$str = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||