|
|||
|
How would I set up a antispam.exim filter to out any email with a Chinese (.cn) URL in the body copy?
I have tried many variations on the following, but nothing seems to work: $message_body contains "http://[0-9a-z].[0-9a-z].cn" Thanks for anything. I have been working at this for a few days now. |
|
|||
|
Wouldn't it have to look something like this:
if $message_body matches "http://[0-9a-z]*\.?[0-9a-z]*\.?[0-9a-z]+\.cn" then fail text "The email contained a link to .cn" seen finish endif Last edited by jerrybell; 08-14-2007 at 07:31 PM. |
|
|||
|
Awk! Thanks, but it still does not work, just tested this.
Here's the filter: or $message_body contains "http://[0-9a-z]?\.[0-9a-z]+\.cn" Here's the spam that was not blocked, i.e. it contains: Hello, teein in 3some gagging on dlK nuide dare http://xfov.blahblahblah.cn/?w=sangwerzporinchpewtbier And yes, I do have the other text lines in the antispam.exim filter file so that other conditions work, such as or $message_body contains "extreme seex" Short sample: # Exim filter if error_message then finish endif if $message_headers contains "tpnet.pl" or $message_headers contains "t-dialin.net" etc etc etc............ then save "/dev/null" 660 endif ------------- Any other ideas I could try to kill all email with a .cn address in it? I don't just want to go with: or $message_body contains ".cn" ... for fear of deleting legitimate email that may have a .cn in it somewhere, ourside of a URL. Last edited by Infopro; 08-14-2007 at 09:41 PM. |
|
||||
|
Quote:
Code:
$message_body contains "http\:\/\/[0-9a-z]*\.?[0-9a-z]*\.?[0-9a-z]+\.cn" Says: match anything with http:// + any number or letter combo + a period (? = one, many or not at all) {repeats x 2} + .cn Or am I misreading?
__________________
Darren Benfer | SS-Darren | AIM: serversphere www.serversphere.com Dedicated Server Solutions Have Come Full Circle |
|
|||
|
Quote:
You're basically there. The question mark means 0 or 1 instance of the pattern, so it's saying 0 or 1 periods ".". The period has to be escaped with a "\", since it has special meaning in regexes. The "*" means any number of instances, including zero of the preceding set. By the way, I tried this and it does actually work. I would just make sure that you're putting it in the right filter file. |
|
||||
|
Quote:
![]() Appreciate you setting me straight on it. So essentially commenting out the colon and slashes immediately after the http made the difference? Cool.
__________________
Darren Benfer | SS-Darren | AIM: serversphere www.serversphere.com Dedicated Server Solutions Have Come Full Circle |
|
|||
|
Still no luck.
I am using this in: /etc/antivirus.exim And I am sure that exim is including the above. Okay, so here is the complete script in antivirus.exim --------------------- # Exim filter if error_message then finish endif if $message_body contains "http://[0-9a-z]*\.?[0-9a-z]*\.?[0-9a-z]+\.cn" then save "/dev/null" 660 endif --------------------- Then I am sending through email with a very simple .cn url in the body copy, e.g. something like www.tugga.cn (after the http prefix). And ot goes right on though. The variations I have tried are as follows: $message_body contains "http\:\/\/[0-9a-z]*\.?[0-9a-z]*\.?[0-9a-z]+\.cn" $message_body contains "http://[0-9a-z]*\.?[0-9a-z]*\.?[0-9a-z]+\.cn" Still no luck. Anyone else? Last edited by jols; 07-04-2009 at 07:49 PM. |
|
|||
|
Quote:
__________________
Content is king. Functionality is a gift. Usability is God. Last edited by Kent Brockman; 07-06-2009 at 11:43 AM. |
|
||||
|
Quote:
seems to match all three of those ![]() mind you, it's off the cuff, so it may not be perfect Break it down though: Code:
http\:\/\/ Code:
(ww[0-9w]\.)? Code:
[^/\s]+ Code:
\.cn\W The key part relevant to your query is the [^/\s]+ doesnt matter what garbage characters you throw at it. unless it's whitespace, or a forward slash, it is assumed to be part of the domain of course that includes far more characters than are valid in domains, but we're merely concerned with snagging the .cn in a URL - resolution is unimportant for once! |
|
|||
|
Yep, and you also could erase the http part so you can trap plain text messages with domain names tricked like this:
Hey, visit nudeogregirls.cn and see our weirdo crap. It may work if you reduce it at: Code:
[^/\s]+\.cn\W
__________________
Content is king. Functionality is a gift. Usability is God. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|