From 30eb7d149c54de3bc039d652352bdcf9a61c8f85 Mon Sep 17 00:00:00 2001 From: stransky Date: Wed, 30 Jan 2002 20:13:29 +0100 Subject: [PATCH] gestion des hostnames avec --host darcs-hash:20020130191329-a279a-1a8a7ef83b928f7d63b982344fbb2eb6fef59d8e.gz --- analyse.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/analyse.pl b/analyse.pl index 99841839..32040e2c 100755 --- a/analyse.pl +++ b/analyse.pl @@ -5,7 +5,7 @@ ## Made by Tab ## ## Started on Tue 09 Oct 2001 01:28:25 AM CEST tab -## Last Update Tue Nov 25 19:00:00 2001 Nico +## Last Update mer 30 jan 2002 19:56:00 CET Nicolas STRANSKY ## ## ## This program is free software; you can redistribute it and/or modify @@ -36,6 +36,7 @@ ## use strict; +use IO::Socket; my $inputfile = "/var/log/net-acct/net-acct.log.0"; my $host = ""; @@ -327,7 +328,8 @@ for (my $ct = 0; $ct < @ARGV; $ct++) } elsif ($ARGV[$ct] eq '-h' || $ARGV[$ct] eq '--host') { if ($ARGV[$ct+1] =~ /[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/) { $host = $ARGV[$ct+1]; $ct++; } - else { usage(); } + else { $host = inet_ntoa((gethostbyname($ARGV[$ct+1]))[4]); $ct++; } + #else { usage(); } # C'est quand meme chiant de pas pouvoir utiliser les hostnames ! Allez, on implémente :) -- Nico } elsif ($ARGV[$ct] =~ '-n' || $ARGV[$ct] eq '--nombre') { if ($ARGV[$ct+1]) { $nombre_line_affiche = $ARGV[$ct+1]; $ct++; }