Subversion Repositories vgwhois

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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