>
> Assuming there is only one set of brackets on a line, and you only want the IP
> address between them, and READLOG is an open handle to your log:
>
> - Not Tested -
> my @ips;
> while (my $line = <READLOG>) {
> if ($line =~ /\[(.*)\]/) {
> push @ips, $1;
> }
> else {
> print STDERR "no ip in line\n";
> }
> }
> print "@ips\n";
>
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]