2
#-----------------------------------------------------------------------------
4
# This plugin allow AWStats to make reverse DNS Lookup on IPv6 addresses.
5
#-----------------------------------------------------------------------------
6
# Perl Required Modules: Net::IP and Net::DNS
7
#-----------------------------------------------------------------------------
8
# $Revision: 1.3 $ - $Author: eldy $ - $Date: 2003/10/29 21:20:39 $
12
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
13
if (!eval ('require "Net/IP.pm";')) { return $@?"Error: $@":"Error: Need Perl module Net::IP"; }
14
if (!eval ('require "Net/DNS.pm";')) { return $@?"Error: $@":"Error: Need Perl module Net::DNS"; }
16
use strict;no strict "refs";
20
#-----------------------------------------------------------------------------
22
#-----------------------------------------------------------------------------
24
# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
25
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
26
my $PluginNeedAWStatsVersion="5.5";
27
my $PluginHooksFunctions="GetResolvedIP";
31
# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
38
#-----------------------------------------------------------------------------
39
# PLUGIN FUNCTION: Init_pluginname
40
#-----------------------------------------------------------------------------
43
my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion);
46
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
47
debug(" InitParams=$InitParams",1);
48
$resolver = Net::DNS::Resolver->new;
51
return ($checkversion?$checkversion:"$PluginHooksFunctions");
55
#-----------------------------------------------------------------------------
56
# PLUGIN FUNCTION: GetResolvedIP_pluginname
57
# UNIQUE: YES (Only one plugin using this function can be loaded)
58
# GetResolvedIP is called to resolve an IPv6 address into a host name
59
#-----------------------------------------------------------------------------
60
sub GetResolvedIP_ipv6 {
62
my $ip = new Net::IP($_[0]);
63
my $reverseip= $ip->reverse_ip();
64
my $query = $resolver->query($reverseip, "PTR");
65
if (! defined($query)) { return; }
66
my @result=split(/\s/, ($query->answer)[0]->string);
72
1; # Do not remove this line