Subversion Repositories vgwhois

Rev

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: bm 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://207.228.133.14/cgi-bin/lansaweb?procfun+BMWHO+BMWHO2+WHO";
31
my $host = "http://www.bermudanic.bm/cgi-bin/lansaweb?procfun+BMWHO+BMWHO2+WHO"; # TODO: https?
32
 
11 daniel-mar 33
my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);
2 daniel-mar 34
 
35
#print "Querying $hostname with $protocol.\n";
36
 
37
# Get session URL
11 daniel-mar 38
my ($text, $exitcode) = VGWhoIs::Core::wwwsgrep($host,'ACTION="(.*?)"');
2 daniel-mar 39
if ($exitcode) {
40
	# print STDERR "Query to web server failed.\n";
41
	print $text;
42
	exit $exitcode;
43
}
44
 
45
# Get lookup
11 daniel-mar 46
($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgipost',"$protocol://$hostname$text",
2 daniel-mar 47
	"ADOM++++++=$query&_PROCESS=BMWHO+&_FUNCTION=BMWHO2+");
48
 
49
if ($exitcode) {
50
	# print STDERR "Query to web server failed.\n";
51
}
52
 
53
# Remove unnecessary stuff
54
$text =~ s/\[.+\]\s+//g; # image reference
55
$text =~ s/Sponsored by\s+//g;
56
 
57
print $text;
58
 
59
exit $exitcode;
60