Subversion Repositories vgwhois

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
#!/usr/bin/perl
2
 
3
#
11 daniel-mar 4
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
5 daniel-mar 5
#  Subprogram: bz TLD whois
2 daniel-mar 6
#
5 daniel-mar 7
#  (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
2 daniel-mar 8
#
5 daniel-mar 9
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
2 daniel-mar 10
#
11
 
12
use warnings;
13
use strict;
14
use utf8;
15
 
16
use FindBin;
4 daniel-mar 17
use lib "$FindBin::RealBin/../../lib/";
11 daniel-mar 18
use VGWhoIs::Core;
2 daniel-mar 19
 
20
if (defined $ARGV[0]) {
21
	$_ = join(' ', @ARGV);
22
} else {
23
	# If no parameter is given, await an input from STDIN
24
	$_ = <>;
25
	chomp;
26
}
27
 
28
my $query = $_;
29
 
30
my $host = "http://www.belizenic.bz/cgi-bin/Registrar_test?action=whois&action2=whois&domain="; # TODO: https?
31
 
11 daniel-mar 32
my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);
2 daniel-mar 33
 
34
#print "Querying $hostname with $protocol.\n";
35
 
36
my $hexstring;
37
$hexstring = $query;
38
$hexstring =~ s/./sprintf("%02x",ord("$&"))/eg;
39
 
11 daniel-mar 40
my ($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgi',$host.$hexstring,'');
2 daniel-mar 41
 
42
if ($exitcode) {
43
	# print STDERR "Query to web server failed.\n";
44
}
45
 
46
print $text;
47
 
48
exit $exitcode;
49