/[hydra]/hydra/examples/resolver.pl
ViewVC logotype

Contents of /hydra/examples/resolver.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sat Sep 21 13:54:15 2002 UTC (21 years, 6 months ago) by nmav
Branch: boas, MAIN
CVS Tags: hydra_0_1_6_without_hic, BOAS_WITH_RANGES_AND_CGI, hydra_0_0_10, start, hydra_0_0_8, hydra_0_0_9, hydra_0_0_2, hydra_0_0_3, hydra_0_0_6, hydra_0_0_7, hydra_0_0_4, hydra_0_0_5, hydra_0_1_3, hydra_0_1_2, hydra_0_1_1, hydra_0_1_0, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Branch point for: hydra_0_1_0_patches
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Imported sources

1 #!/usr/bin/perl
2
3 # IP address resolver for Boa
4
5 # If you want an "in place" change to the log file,
6 # change the first line to
7 #!/usr/local/bin/perl -i.bak
8 # Otherwise, send the output of this program wherever you want:
9 # resolver.pl access_log >access_log_resolved
10
11 $AF_INET = 2;
12
13 while(<>) {
14 next unless (($ip, $rest) = /([\d\.]+) (.*)/o);
15
16 if(!$hosts{$ip}) {
17 $packed_ip = pack('C4', split(/\./, $ip));
18 $host = (gethostbyaddr($packed_ip, $AF_INET))[0];
19 $hosts{$ip} = ($host ? $host : $ip);
20 }
21
22 print "$hosts{$ip} $rest\n";
23 }
24

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26