Re: [exim] REGEX help - Picking IP addresses out of Received…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Mike Cardwell
Päiväys:  
Vastaanottaja: Marc Perkel
Kopio: exim users, Dan_Mitton
Aihe: Re: [exim] REGEX help - Picking IP addresses out of Received Headers
Marc Perkel wrote:
>
> Dan_Mitton@??? wrote:
>> This might be getting close...
>>
>> If you pipe in a list of new-line separated 'Received' headers in this
>> Perl script:
>>
>> $foo="";
>>
>> while (<STDIN>)
>> {$foo .= $_};
>>
>> $foo =~ s/(from .*?\(\[)(.*?)(\]\).*?$)/$2/gm;
>> print $foo;
>>
>> it will output a new-line separated list of IP addresses.
>>
>> Does that help at all??
>>
>>
>>
>
> What I was looking for was an Exim ACL that would say grab the second
> one and put it into one variable and then write another regex to get the
> third one into a variable, etc. Then I'd use the contents of the
> variable to do a blacklist lookup. I'm not sure how I would use a perl
> script to do it.


You could modify the following:

http://exim.org/mail-archives/exim-users/Week-of-Mon-20070212/msg00116.html

That acl pull out all of the ip addresses from the received headers and
does dnsbl lookups on them.

Although I believe there are some new functions in the latest version of
exim that would allow this to be done without resorting to a recursive
algorithm.

Mike