Subversion Repositories vgwhois

Rev

Rev 5 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

#!/usr/bin/perl

#
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
#  Subprogram: pe TLD whois
#
#  (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
#
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
#

use warnings;
use strict;
use utf8;

use FindBin;
use lib "$FindBin::RealBin/../lib/";
use VGWhoIs::Core;

if (defined $ARGV[0]) {
        $_ = join(' ', @ARGV);
} else {
        # If no parameter is given, await an input from STDIN
        $_ = <>;
        chomp;
}

my $query = $_;

my $host       = "http://www.nic.pe/rpublicac-i.php?txtbuscar=$query&radopcion=D"; # TODO: https?
my $additional = "(detpublic-i.php.*?)'";

my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);

#print "Querying $hostname with $protocol.\n";

my ($text, $exitcode) = VGWhoIs::Core::wwwsgrep($host,$additional);
if ($exitcode) {
        # print STDERR "Query to web server failed.\n";
        print $text;
        exit $exitcode;
}

if ($text ne '') {
        print "Match found. Now querying for the domain data.\n\n";
        ($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgi',"$protocol://$hostname/$text", '');
        print $text;
} else {
        print "No match found. This probably means that this domain does not exist.\n";
}

if ($exitcode) {
        # print STDERR "Query to web server failed.\n";
}

exit $exitcode;