]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
The link to whois informations for a host, provided by hostinfo plugin, has been...
authoreldy <>
Fri, 5 Dec 2003 21:44:08 +0000 (21:44 +0000)
committereldy <>
Fri, 5 Dec 2003 21:44:08 +0000 (21:44 +0000)
docs/awstats_changelog.txt
docs/awstats_config.html
tools/awstats_buildstaticpages.pl
wwwroot/cgi-bin/awstats.model.conf
wwwroot/cgi-bin/awstats.pl
wwwroot/cgi-bin/plugins/hostinfo.pm

index 76511dc31bac8fc8b3cea290b0a59fecf1b9f68f..df936ba8d32cef3d4e0fc5c157c0f72c4551e24b 100644 (file)
@@ -42,6 +42,9 @@ New features/improvements:
   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.
index 368941fea49c6c42103b74da4b4a03c28d92d401..fc871c13a87591ec0d310ac7277b60d82c756c6f 100644 (file)
@@ -1517,26 +1517,20 @@ parameter.
 <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>
 
index 9c7fc681435df20ee37413dcc0126496b8f0b3b9..c04658b85add8249f0f19cc991de2fb3d7836e39 100644 (file)
@@ -343,7 +343,9 @@ if ($Date) {
 
 
 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"; }
index 3d362713d9d3f7090c30aeab95464dfbedd16725..c9aef8d4e7b66fcd5e9b97fa5367a6e600a024e9 100644 (file)
@@ -1050,23 +1050,6 @@ UseHTTPSLinkForUrl=""
 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: ""
 #
@@ -1198,9 +1181,9 @@ color_x="C1B2E2"                          # Background color for number of exit pages (Default = "C1B2
 #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"
 
index d538f577b8962908d1b01e0ea7e1a461069e3f2e..c313ade2682cd7b16a8b4779783f49329926bef2 100644 (file)
@@ -5330,7 +5330,7 @@ if ($ENV{'GATEWAY_INTERFACE'}) {  # Run from a browser as CGI
 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/-.*$//;
@@ -5345,11 +5345,12 @@ if (! $Lang || $Lang eq 'auto') { debug(" No language defined or available. Will
 
 # 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') {
@@ -9745,7 +9746,7 @@ if (scalar keys %HTMLOutput) {
                                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};
@@ -9754,7 +9755,7 @@ if (scalar keys %HTMLOutput) {
                        &tab_end("* $Message[154]");
                }
 
-               # BY SMTP ERRORS
+               # BY SMTP STATUS
                #----------------------------
                if ($ShowSMTPErrorsStats) {
                        if ($Debug) { debug("ShowSMTPErrorsStats",2); }
@@ -9768,7 +9769,7 @@ if (scalar keys %HTMLOutput) {
                        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};
index 2afcafc4286c6192f6a53dcd814a76a9fe4b1542..5172a69e74833d5a8461746baad02e8a39ada686 100644 (file)
@@ -1,15 +1,17 @@
 #!/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";
 
@@ -22,7 +24,7 @@ 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";
 # ----->
 
 # <-----
@@ -43,7 +45,6 @@ sub Init_hostinfo {
        # <-----
        # 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");
@@ -66,8 +67,8 @@ sub AddHTMLBodyHeader_hostinfo {
 <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>
 
@@ -122,4 +123,64 @@ sub ShowInfoHost_hostinfo {
 }
 
 
+#-----------------------------------------------------------------------------
+# 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())."&nbsp;</td></tr>";\r
+       print "<tr><td>Status</td><td>".($w->status())."&nbsp;</td></tr>";\r
+       print "<tr><td>NameServers</td><td>".($w->nameservers())."&nbsp;</td></tr>";\r
+       print "<tr><td>Registrant</td><td>".($w->registrant())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Admin</td><td>".($w->contact_admin())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Tech</td><td>".($w->contact_tech())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Billing</td><td>".($w->contact_billing())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Zone</td><td>".($w->contact_zone())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Emails</td><td>".($w->contact_emails())."&nbsp;</td></tr>";\r
+       print "<tr><td>Contact Handles</td><td>".($w->contact_handles())."&nbsp;</td></tr>";\r
+       print "<tr><td>Domain Handles</td><td>".($w->domain_handles())."&nbsp;</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