supported for the moment).
- A lot of part of codes have been rewritten to make code more easy to
understand and reduce unknown bugs.
+- The link to whois informations for a host, provided by hostinfo plugin,
+ has been replaced by an internal 'whois' showing in a popup window full
+ whois informations whatever is the TLD of IP or host name.
- A new search engine database to allow several "match id" for same
search engine. Example: All google ip referer id are recognised.
- Can use UA and HOST fields to build personalized ExtraSection reports.
<br><br><hr>
<a name="LinksToWhoIs"><b>LinksToWhoIs</b></a><br>
-<b>Version : </b>4.0+<br>
-<br># Set here the link used to point to Internet WhoIs database for hostnames.
-<br># This parameter is not used if plugin hostinfo is not enabled.
-<br># Default: "http://www.whois.net/search.cgi2?str="
-<br># Example: "http://www.netsol.com/cgi-bin/whois/whois?SearchType=all&STRING="
-<br># Example: "http://www.ripe.net/perl/whois?form_type=simple&searchtext="
-<br># Example: "http://www.arin.net/cgi-bin/whois.pl?queryinput="
-<br>#
-<br>LinksToWhoIs="http://www.whois.net/search.cgi2?str="
+<font color="#808080">
+<b>Version : </b>4.0 - 5.9 (deprecated since 6.0, replaced by plugin 'hostinfo')<br>
+This parameter has been removed since 6.0.<br>
+This parameter is no more required.
+</font>
<br><br><hr>
<a name="LinksToIPWhoIs"><b>LinksToIPWhoIs</b></a><br>
-<b>Version : </b>5.0+<br>
-<br># Set here the link used to point to Internet WhoIs database for ip addresses.
-<br># This parameter is not used if plugin hostinfo is not enabled.
-<br># Default: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-<br># Example: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-<br>#
-<br>LinksToIPWhoIs="http://ws.arin.net/cgi-bin/whois.pl?queryinput="
+<font color="#808080">
+<b>Version : </b>5.0 - 5.9 (deprecated since 6.0, replaced by plugin 'hostinfo')<br>
+This parameter has been removed since 6.0.<br>
+This parameter is no more required.
+</font>
<br><br><hr>
my $cpt=0;
-my $smallcommand="\"$Awstats\" -config=$SiteConfig".($BuildPDF?" -buildpdf -noloadplugin=tooltips,rawlog,hostinfo":"")." -staticlinks".($OutputSuffix ne $SiteConfig?"=$OutputSuffix":"");
+my $NoLoadPlugin="";
+if ($BuildPDF) { $NoLoadPlugin.="tooltips,rawlog,hostinfo"; }
+my $smallcommand="\"$Awstats\" -config=$SiteConfig".($BuildPDF?" -buildpdf":"").($NoLoadPlugin?" -noloadplugin=$NoLoadPlugin":"")." -staticlinks".($OutputSuffix ne $SiteConfig?"=$OutputSuffix":"");
if ($StaticExt && $StaticExt ne 'html') { $smallcommand.=" -staticlinksext=$StaticExt"; }
if ($DirIcons) { $smallcommand.=" -diricons=$DirIcons"; }
if ($Lang) { $smallcommand.=" -lang=$Lang"; }
MaxLengthOfShownURL=64
-# Set here the link used to point to Internet WhoIs database for hostnames.
-# This parameter is not used if plugin hostinfo is not enabled.
-# Default: "http://www.whois.net/search.cgi2?str="
-# Example: "http://www.ripe.net/perl/whois?form_type=simple&searchtext="
-# Example: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-#
-LinksToWhoIs="http://www.whois.net/search.cgi2?str="
-
-
-# Set here the link used to point to Internet WhoIs database for ip addresses.
-# This parameter is not used if plugin hostinfo is not enabled.
-# Default: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-# Example: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-#
-LinksToIPWhoIs="http://ws.arin.net/cgi-bin/whois.pl?queryinput="
-
-
# You can enter HTML code that will be added at the top of AWStats reports.
# Default: ""
#
#LoadPlugin="userinfo"
# Plugin: HostInfo
-# Perl modules required: None
-# Add a column into host chart with a clicable link to a popup that show WhoIs
-# info, on a popup window.
+# Perl modules required: XWhois
+# Add a column into host chart with a link to open a popup window that shows
+# info on host (like whois records).
#
#LoadPlugin="hostinfo"
if ($QueryString =~ /(^|&)lang=([^&]+)/i) { $Lang="$2"; }
if (! $Lang || $Lang eq 'auto') { # If lang not defined or forced to auto
my $langlist=$ENV{'HTTP_ACCEPT_LANGUAGE'}||''; $langlist =~ s/;[^,]*//g;
- debug("Search an available language among HTTP_ACCEPT_LANGUAGE=$langlist",1);
+ if ($Debug) { debug("Search an available language among HTTP_ACCEPT_LANGUAGE=$langlist",1); }
foreach my $code (split(/,/,$langlist)) { # Search for a valid lang in priority
if ($LangBrowserToLangAwstats{$code}) { $Lang=$LangBrowserToLangAwstats{$code}; debug(" Will try to use Lang=$Lang",1); last; }
$code =~ s/-.*$//;
# Define frame name and correct variable for frames
if (! $FrameName) {
- if ($ENV{'GATEWAY_INTERFACE'} && $UseFramesWhenCGI && $HTMLOutput{'main'}) { $FrameName='index'; }
+ if ($ENV{'GATEWAY_INTERFACE'} && $UseFramesWhenCGI && $HTMLOutput{'main'} && ! $PluginMode) { $FrameName='index'; }
else { $FrameName='main'; }
}
# Load Message files, Reference data files and Plugins
+if ($Debug) { debug("FrameName=$FrameName",1); }
if ($FrameName ne 'index') {
&Read_Language_Data($Lang);
if ($FrameName ne 'mainleft') {
my $p=int($_errors_h{$key}/$TotalHitsErrors*1000)/10;
print "<tr".($TOOLTIPON?" onmouseover=\"ShowTip($key);\" onmouseout=\"HideTip($key);\"":"").">";
if ($TrapInfosForHTTPErrorCodes{$key}) { print "<td><a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=errors$key"):"$PROG$StaticLinks.errors$key.$StaticExt")."\"$NewLinkTarget>$key</a></td>"; }
- else { print "<td>$key</td>"; }
+ else { print "<td valign=\"top\">$key</td>"; }
print "<td class=\"aws\">".($httpcodelib{$key}?$httpcodelib{$key}:'Unknown error')."</td><td>$_errors_h{$key}</td><td>$p %</td><td>".Format_Bytes($_errors_k{$key})."</td>";
print "</tr>\n";
$total_h+=$_errors_h{$key};
&tab_end("* $Message[154]");
}
- # BY SMTP ERRORS
+ # BY SMTP STATUS
#----------------------------
if ($ShowSMTPErrorsStats) {
if ($Debug) { debug("ShowSMTPErrorsStats",2); }
foreach my $key (@keylist) {
my $p=int($_errors_h{$key}/$TotalHitsErrors*1000)/10;
print "<tr".($TOOLTIPON?" onmouseover=\"ShowTip($key);\" onmouseout=\"HideTip($key);\"":"").">";
- print "<td>$key</td>";
+ print "<td valign=\"top\">$key</td>";
print "<td class=\"aws\">".($smtpcodelib{$key}?$smtpcodelib{$key}:'Unknown error')."</td><td>$_errors_h{$key}</td><td>$p %</td><td>".Format_Bytes($_errors_k{$key})."</td>";
print "</tr>\n";
$total_h+=$_errors_h{$key};
#!/usr/bin/perl
#-----------------------------------------------------------------------------
# HostInfo AWStats plugin
-# This plugin allow you to add information on hosts, like a whois link.
+# This plugin allow you to add information on hosts, like a whois fields.
#-----------------------------------------------------------------------------
-# Perl Required Modules: None
+# Perl Required Modules: XWhois
#-----------------------------------------------------------------------------
# $Revision$ - $Author$ - $Date$
# <-----
-# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES.
+push @INC, "${DIR}/plugins";
+# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
+if (!eval ('require "Net/XWhoIs.pm";')) { return $@?"Error: $@":"Error: Need Perl module Net::XWhoIs"; }
# ----->
use strict;no strict "refs";
# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
my $PluginNeedAWStatsVersion="5.7";
-my $PluginHooksFunctions="ShowInfoHost AddHTMLBodyHeader";
+my $PluginHooksFunctions="ShowInfoHost AddHTMLBodyHeader BuildFullHTMLOutput";
# ----->
# <-----
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
debug(" InitParams=$InitParams",1);
- if (! $LinksToWhoIs || ! $LinksToIPWhoIs) { return "Error: Parameters LinksToWhoIs and LinksToIPWhoIs must be defined in config file to use hostinfo plugin."; }
# ----->
return ($checkversion?$checkversion:"$PluginHooksFunctions");
<script language="javascript" type="text/javascript">
function neww(a,b) {
var wfeatures="directories=0,menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,width=$WIDTHINFO,height=$HEIGHTINFO,left=" + eval("(screen.width - $WIDTHINFO)/2") + ",top=" + eval("(screen.height - $HEIGHTINFO)/2");
- if (b==1) { fen=window.open('$LinksToWhoIs'+a,'whois',wfeatures); }
- if (b==2) { fen=window.open('$LinksToIPWhoIs'+a,'whois',wfeatures); }
+ if (b==1) { fen=window.open('$AWScript?pluginmode=hostinfo&host='+a,'whois',wfeatures); }
+ if (b==2) { fen=window.open('$AWScript?pluginmode=hostinfo&host='+a,'whois',wfeatures); }
}
</script>
}
+#-----------------------------------------------------------------------------
+# PLUGIN FUNTION: 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 $regipv4=qr/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
+# my $regipv6=qr/^[0-9A-F]*:/i;
+
+ my $Host='';
+ if ($QueryString =~ /host=([^&]+)/i) {
+ $Host=lc(&DecodeEncodedString("$1"));
+ }
+
+ my $ip='';
+ my $HostResolved='';
+# 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(" DirData=$DirData Host=$Host HostResolved=$HostResolved ",4); }
+ my $w = new Net::XWhois Verbose=>$Debug, Cache=>$DirData, NoCache=>0, Timeout=>30, Domain=>$HostResolved;
+
+ print "<br>\n";
+
+ &tab_head("Common Whois Fields",0,0,'whois');
+ print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>Common field info</th><th>Value</th></tr>\n";
+ print "<tr><td>Name</td><td>".($w->name())." </td></tr>";\r
+ print "<tr><td>Status</td><td>".($w->status())." </td></tr>";\r
+ print "<tr><td>NameServers</td><td>".($w->nameservers())." </td></tr>";\r
+ print "<tr><td>Registrant</td><td>".($w->registrant())." </td></tr>";\r
+ print "<tr><td>Contact Admin</td><td>".($w->contact_admin())." </td></tr>";\r
+ print "<tr><td>Contact Tech</td><td>".($w->contact_tech())." </td></tr>";\r
+ print "<tr><td>Contact Billing</td><td>".($w->contact_billing())." </td></tr>";\r
+ print "<tr><td>Contact Zone</td><td>".($w->contact_zone())." </td></tr>";\r
+ print "<tr><td>Contact Emails</td><td>".($w->contact_emails())." </td></tr>";\r
+ print "<tr><td>Contact Handles</td><td>".($w->contact_handles())." </td></tr>";\r
+ print "<tr><td>Domain Handles</td><td>".($w->domain_handles())." </td></tr>";\r
+ &tab_end;
+
+ &tab_head("Full Whois Field",0,0,'whois');
+ print "<tr><td class=\"aws\"><pre>".($w->response())."</pre></td></tr>\n";
+ &tab_end;
+
+ return 1;
+ # ----->
+}
+
1; # Do not remove this line