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