Subversion Repositories vgwhois

Rev

Rev 4 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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