procmail
[Top] [All Lists]

Re: Collect IP-nrs

2002-03-17 17:10:45
Ruud is trying to extract IP numbers from ALL Received: headers and, 
not having much luck getting past the first such header, offered this
log snippet:

| I simplified the values of IP and REGEXP and MATEXP as following:
|   IP=[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+
|   REGEXP="^Received:${WSP}from${WSP}"
|   MATEXP="^Received:${WSP}from${WSP}.*[^0-9.]\/$IP"
| to make the log-file more easily readable.
| 
| 
| The log-file now shows:
| 
| procmail: Assigning "INCLUDERC=/xxx/XIP.rc"
| procmail: Assigning "MATCH="
| procmail: Matched "194.109.6.50"
| procmail: Match on
| ed:[         ]+from[         ]+.*[^0-9.]\/[0-9]+[.][0-9]+[.][0-9]+[.][0-9]
| +"
| procmail: Assigning "XIP=[194.109.6.50]"
| procmail: No match on
| ^Received:[  ]+from[  ]+(.*$)*\/^Received:[  ]+from[  ]+(.*$)*"
| 

My *guess* is the ^ anchor in the middle of the regexp isn't working as
you want.  My brain isn't prepared to analyze this further right now,
but I can offer a couple tips.

1. Personally I've had more luck using "\>" (or "\<") when matching over
multiple lines with procmail regular expressions. Those "word boundary"
tokens will match a newline.

2. I have an rcfile that processes all Received: headers, for a
different (apparent) purpose than yours. What I use probably has too
much stuff dependent on my local configuration to be helpful, but it
was borrowed heavily from:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/1999-07/msg00095.html

That example might be helpful for you.

Sorry I don't have time or brain power for more right now, but maybe
that'll get you started.

Don Hammond
 
-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>