[PLUG] Question

mikeraz at patch.com mikeraz at patch.com
Wed Apr 24 18:59:27 UTC 2002


Abraham,

Assuming that you want to use your current output for input:

#!/usr/bin/perl

while(<>) {
	($user, $host, @date) = split;
	$logins{$user."\t".$host}++;
}

foreach $u (keys %logins) {
	print "$u\tfailed logins=$logins{$u}\n";
}

	


On Wed, Apr 24, 2002 at 11:18:33AM -0700, Abraham Zwygart typed:
> 
> I have a script that list all users that try to logon a linux pop3 email server
> incorrectly.
> It sorts (by logon and address) and emails the list to me.  I would like to take it
> one
> step further, and that is to only list each person once with the number of times
> they had a failed login.
> 
> sample of the output:
> user=usera           host=[##.##.##.1]     Apr 23 11:09:53
> user=usera           host=[##.##.##.1]     Apr 23 11:10:04
> user=usera           host=[##.##.##.1]     Apr 23 11:10:40
> user=usera           host=[##.##.##.1]     Apr 23 11:10:50
> user=userb           host=[##.##.##.2]     Apr 22 06:43:39
> user=userb           host=[##.##.##.2]     Apr 22 12:02:57
> user=userb           host=[##.##.##.2]     Apr 22 12:03:02
> user=userc           host=[##.##.##.3]     Apr 24 10:38:29
> 
> would like:
> user=usera           host=[##.##.##.1]   faild logins=4
> user=userb           host=[##.##.##.2]   faild logins=3
> user=userc           host=[##.##.##.3]   faild logins=1
> 
> The count needs to change when the user name and ip address change.
> Is there a easy script command that can do this?
> 
> Thanks
> Abraham Z.
> 
> --
> +-----------------------------------------------------------------------------
> | Abraham Zwygart                        Senior Programmer Analyst/
> | SAPA Anodizing Inc.                             Database Administrator
> | 7933 N. E. 21st Avenue                Email: ziggy at anodizing.com
> | Portland, OR 97211
> | Phone: (503) 972-1404 x 1232     Fax:   (503) 972-1408
> |
> | The thoughts, comments, and opinions expressed herein are mine
> | and do not reflect those of my employer, or anyone else.
> +-----------------------------------------------------------------------------
> 
> 
> 
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug

-- 
    Michael Rasmussen  aka  mikeraz
   Be appropriate && Follow your curiosity
   "They that give up essential liberty to obtain
   temporary safety, deserve neither liberty nor safety."
				-- Benjamin Franklin 	
     But keep in mind:
Never promise more than you can perform.
		-- Publilius Syrus




More information about the PLUG mailing list