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 | # |
||
11 | daniel-mar | 4 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
5 | daniel-mar | 5 | # Subprogram: bi 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://whois.nic.bi/register/whois.hei"; # 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 | # Get session URL |
||
11 | daniel-mar | 37 | my ($text, $exitcode) = VGWhoIs::Core::wwwsgrep($host,'name="card" value="(.*?)'); |
2 | daniel-mar | 38 | if ($exitcode) { |
39 | # print STDERR "Query to web server failed.\n"; |
||
40 | print $text; |
||
41 | exit $exitcode; |
||
42 | } |
||
43 | |||
44 | # Get lookup |
||
11 | daniel-mar | 45 | ($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgi',"$host?card=$text&f_1.qdomain=$query&f_1.type=domain&f_1.q=Search"); |
2 | daniel-mar | 46 | |
47 | if ($exitcode) { |
||
48 | # print STDERR "Query to web server failed.\n"; |
||
49 | } |
||
50 | |||
51 | print $text; |
||
52 | |||
53 | exit $exitcode; |