EOF
return 1;
# ----->
}
#-----------------------------------------------------------------------------
# PLUGIN FUNCTION: ShowInfoHost_pluginname
# UNIQUE: NO (Several plugins using this function can be loaded)
# Function called to add additionnal columns to the Hosts report.
# This function is called when building rows of the report (One call for each
# row). So it allows you to add a column in report, for example with code :
# print "This is a new cell for $param | ";
# Parameters: Host name or ip
#-----------------------------------------------------------------------------
sub ShowInfoHost_hostinfo {
my $param="$_[0]";
# <-----
if ($param eq '__title__') {
print "$Message[114] | ";
}
elsif ($param) {
my $keyforwhois;
if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
$keyforwhois=$param;
}
elsif ($param =~ /^[0-9A-F]*:/i) { # IPv6 address
$keyforwhois=$param;
}
else { # Hostname
$param =~ /([-\w]+\.[-\w]+\.(?:au|uk|jp|nz))$/ or $param =~ /([-\w]+\.[-\w]+)$/;
$keyforwhois=$1;
}
print "";
# if ($keyforwhois) { print "?"; }
if ($keyforwhois) { print "?"; }
else { print " " }
print " | ";
}
else {
print " | ";
}
return 1;
# ----->
}
#-----------------------------------------------------------------------------
# PLUGIN FUNCTION: BuildFullHTMLOutput_pluginname
# UNIQUE: NO (Several plugins using this function can be loaded)
# Function called to output an HTML page completely built by plugin instead
# of AWStats output
#-----------------------------------------------------------------------------
sub BuildFullHTMLOutput_hostinfo {
# <-----
my $Host='';
if ($QueryString =~ /host=([^&]+)/i) {
$Host=lc(&DecodeEncodedString("$1"));
}
my $ip='';
my $HostResolved='';
# my $regipv4=qr/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
# my $regipv6=qr/^[0-9A-F]*:/i;
# if ($Host =~ /$regipv4/o) { $ip=4; }
# elsif ($Host =~ /$regipv6/o) { $ip=6; }
# if ($ip == 4) {
# my $lookupresult=lc(gethostbyaddr(pack("C4",split(/\./,$Host)),AF_INET)); # This is very slow, may spend 20 seconds
# if (! $lookupresult || $lookupresult =~ /$regipv4/o || ! IsAscii($lookupresult)) {
# $HostResolved='*';
# }
# else {
# $HostResolved=$lookupresult;
# }
# if ($Debug) { debug(" Reverse DNS lookup for $Host done: $HostResolved",4); }
# }
if (! $ip) { $HostResolved=$Host; }
if ($Debug) { debug(" Plugin hostinfo: DirData=$DirData Host=$Host HostResolved=$HostResolved ",4); }
my $w = new Net::XWhois Verbose=>$Debug, Cache=>$DirData, NoCache=>0, Timeout=>10, Domain=>$HostResolved;
print "
\n";
if ($w && $w->response()) {
&tab_head("Common Whois Fields",0,0,'whois');
print "Common field info | Value |
\n";
print "Name | ".($w->name())." |
";
print "Status | ".($w->status())." |
";
print "NameServers | ".($w->nameservers())." |
";
print "Registrant | ".($w->registrant())." |
";
print "Contact Admin | ".($w->contact_admin())." |
";
print "Contact Tech | ".($w->contact_tech())." |
";
print "Contact Billing | ".($w->contact_billing())." |
";
print "Contact Zone | ".($w->contact_zone())." |
";
print "Contact Emails | ".($w->contact_emails())." |
";
print "Contact Handles | ".($w->contact_handles())." |
";
print "Domain Handles | ".($w->domain_handles())." |
";
&tab_end;
}
&tab_head("Full Whois Field",0,0,'whois');
if ($w && $w->response()) {
print "".CleanXSS($w->response())." |
\n";
}
else {
print " The Whois command failed. Did the server running AWStats is allowed to send WhoIs queries (If a firewall is running, port 43 should be opened from inside to outside) ?
|
\n";
}
&tab_end;
return 1;
# ----->
}
1; # Do not remove this line