This is what I came up with. Tested and works.
#!/usr/bin/perl -w
use strict;
open DATA, "<data.txt"; # data.txt is the logfile the ips are in
open IPS, ">ips.txt"; # this is the output file with the ip list
while (<DATA>) {
if ($_ =~ /\[(\w+\.\w+\.\w+\.\w+)\]/) {
print IPS "$1\n";
}
}
Chris Carver
Pennswoods.net
Mail Administrator
> I don't mean to sound stupid, but uhhhh *scratch-scratch* what's a
> READLOG open handle? ;-)
>
> I have about 7500+ messages in a spam folder on the mail server (in
> Maildir) and I'm trying top parse them out.
>
> Here's my stupid script so far:
>
> #!/usr/bin/perl
>
> @fileList = `ls -1`;
> $filecount = "5";
>
> #$makeIPList = `cat @fileList[$filecount]`;
> @fileList[$filecount] =~ s/\]/\[/g;
> @getIP = `grep Received\: @fileList[$filecount]`;
> [EMAIL PROTECTED] =~ s/\]/\[/g;
>
> @split = split (/\[/, $getIP);
>
> print "getIP---- @getIP\n";
> print "filelist- @fileList[filecount]\n";
>
>
> and here's the output:
>
> getIP---- Received: from 24.60.195.149
> (h00a0cce008a4.ne.client2.attbi.com [24.60.195.149])
> Received: from 11.139.74.233 ([11.139.74.233]) by n7.groups.yahoo.com
> with NNFMP; May, 17 2003 1:51:07 AM +0700
> Received: from 30.215.79.204 ([30.215.79.204]) by m10.grp.snv.yahoo.com
> with SMTP; May, 17 2003 12:44:43 AM -0800
>
> filelist- 1053130715.9788_5.mail2.horvitznewspapers.net,S=15311:
>
> I just set the counter at 5 as a test I will turn that into an
> incrementing dealy when I can get it to work. I'm trying to figure out
> how to make a text file with all the IP's that the spam is coming from.
>
>
>
> --Bryan
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]