Rev 5 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
2 | 2 | ||
3 | # |
3 | # |
4 | # VWhois (ViaThinkSoft WHOIS, a fork of generic Whois / gwhois) |
4 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
5 | # Subprogram: pe TLD whois |
5 | # Subprogram: pe TLD whois |
6 | # |
6 | # |
7 | # (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
7 | # (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
8 | # |
8 | # |
9 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
9 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
Line 13... | Line 13... | ||
13 | use strict; |
13 | use strict; |
14 | use utf8; |
14 | use utf8; |
15 | 15 | ||
16 | use FindBin; |
16 | use FindBin; |
17 | use lib "$FindBin::RealBin/../lib/"; |
17 | use lib "$FindBin::RealBin/../lib/"; |
18 | use GWhoIs::Core; |
18 | use VGWhoIs::Core; |
19 | 19 | ||
20 | if (defined $ARGV[0]) { |
20 | if (defined $ARGV[0]) { |
21 | $_ = join(' ', @ARGV); |
21 | $_ = join(' ', @ARGV); |
22 | } else { |
22 | } else { |
23 | # If no parameter is given, await an input from STDIN |
23 | # If no parameter is given, await an input from STDIN |
Line 28... | Line 28... | ||
28 | my $query = $_; |
28 | my $query = $_; |
29 | 29 | ||
30 | my $host = "http://www.nic.pe/rpublicac-i.php?txtbuscar=$query&radopcion=D"; # TODO: https? |
30 | my $host = "http://www.nic.pe/rpublicac-i.php?txtbuscar=$query&radopcion=D"; # TODO: https? |
31 | my $additional = "(detpublic-i.php.*?)'"; |
31 | my $additional = "(detpublic-i.php.*?)'"; |
32 | 32 | ||
33 | my ($protocol, $hostname) = GWhoIs::Utils::splitProtocolHost($host); |
33 | my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host); |
34 | 34 | ||
35 | #print "Querying $hostname with $protocol.\n"; |
35 | #print "Querying $hostname with $protocol.\n"; |
36 | 36 | ||
37 | my ($text, $exitcode) = GWhoIs::Core::wwwsgrep($host,$additional); |
37 | my ($text, $exitcode) = VGWhoIs::Core::wwwsgrep($host,$additional); |
38 | if ($exitcode) { |
38 | if ($exitcode) { |
39 | # print STDERR "Query to web server failed.\n"; |
39 | # print STDERR "Query to web server failed.\n"; |
40 | print $text; |
40 | print $text; |
41 | exit $exitcode; |
41 | exit $exitcode; |
42 | } |
42 | } |
43 | 43 | ||
44 | if ($text ne '') { |
44 | if ($text ne '') { |
45 | print "Match found. Now querying for the domain data.\n\n"; |
45 | print "Match found. Now querying for the domain data.\n\n"; |
46 | ($text, $exitcode) = GWhoIs::Core::doquery($query,'cgi',"$protocol://$hostname/$text", ''); |
46 | ($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgi',"$protocol://$hostname/$text", ''); |
47 | print $text; |
47 | print $text; |
48 | } else { |
48 | } else { |
49 | print "No match found. This probably means that this domain does not exist.\n"; |
49 | print "No match found. This probably means that this domain does not exist.\n"; |
50 | } |
50 | } |
51 | 51 |