🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
6 messages
6 total messages Started by Randolph Carter Fri, 21 Feb 2003 06:17
[Xnews] Regular expression scoring help?
#120488
Author: Randolph Carter
Date: Fri, 21 Feb 2003 06:17
24 lines
1528 bytes
Hello,

Hoping to get some help from the regular expression experts.

Getting frustrated trying to write a filter in regex which basically 
says:

if subject is X characters long, and does NOT contain a space, kill it.

This is in an attempt to kill the random newsgroups attacks where some 
jackass posts hundreds or thousands with subjects like:

Subject: #]1eq/e7f8T6B`s4>$mz/H5T_8IpHnT\9K2bCk1CD8ES(3k2.?bhl!m+T=hV

Any help is gladly accepted.

Also, if anyone has handy and effective general spam filters, feel free 
to post those also.

Your time and expertise is appreciated!

Regards,
Randolph Carter
Re: [Xnews] Regular expression scoring help?
#120487
Author: Murray Peterson
Date: Fri, 21 Feb 2003 06:39
16 lines
1479 bytes
Randolph Carter <azoblue@myrealboxDOT.com> wrote in 
news:Xns9328ED0A14845sethralavode@68.1.17.6:

> if subject is X characters long, and does NOT contain a space, kill it.

Say X is 50, this will kill any subject that length or longer that has no 
space character (which is what I assume you want):

Score:: -9999
Subject: [^ ]{50,}

-- 
Murray Peterson
Email: murray_peterson@shaw.ca (remove underscore)
URL:   http://members.shaw.ca/murraypeterson/
Re: [Xnews] Regular expression scoring help?
#120494
Author: Randolph Carter
Date: Fri, 21 Feb 2003 07:17
23 lines
1552 bytes
Murray Peterson <mwp@home.com.invalid> wrote in
news:Xns9328F0E3F498farkle@24.71.223.159: 

> Randolph Carter <azoblue@myrealboxDOT.com> wrote in 
> news:Xns9328ED0A14845sethralavode@68.1.17.6:
> 
>> if subject is X characters long, and does NOT contain a space, kill
>> it. 
> 
> Say X is 50, this will kill any subject that length or longer that has
> no space character (which is what I assume you want):
> 
> Score:: -9999
> Subject: [^ ]{50,}
> 

Ergh.  Exactly what I was looking for.

Thank you!

Rereading the Regex faqs,
Randolph Carter
Re: [Xnews] Regular expression scoring help?
#120589
Author: Tech Zero
Date: Sat, 22 Feb 2003 12:20
46 lines
2294 bytes
The voice of "Murray Peterson" drifted in on the cyber-winds, 
from the sea of virtual chaos...

> Randolph Carter <azoblue@myrealboxDOT.com> wrote in 
> news:Xns9328ED0A14845sethralavode@68.1.17.6:
> 
>> if subject is X characters long, and does NOT contain a space,
>> kill it. 
> 
> Say X is 50, this will kill any subject that length or longer that
> has no space character (which is what I assume you want):
> 
> Score:: -9999
> Subject: [^ ]{50,}


That would kill the first post, but not the replies.

Then again, it looks like your looking for post that doesn't contain a
space in the first 50 or more characters. Since the value of "X" (50)
in that entry is immaterial, setting it to say 20 is just as safe.

Not that I'm trying to hack you skillz Murray...

Randolph... 
Another way to do it would be to use the "non space" wildcard along
with a possible starts with "Re: ". This will catch all replies as
well unless they change the subject:

  Score: -9999
    Subject: ^(Re: )?\S{20,}

Ohh, here's a couple more freebies for you...

 POrn Spam    "H.o.t. C.h.i.c.k.s"  (\w\W\s?){7,} 
 Tagged Spam  "        #243A725g#"  \s{2,}\W?\d{4,}\W?$ 
 Lolita Spam  "14 year olds girls"  1\d\sy(o|(ea)?r)

You can drop it all in the same entry if you like:

  Score: -9999
    Subject: \s{2,}\W?\d{4,}\W?$|(\w\W\s?){7,}|1\d\sy(o|(ea)?r)|^(Re: )?\S{20,}

-- 
The Tech Zero, Maxwell C.G. Pollare
Re: [Xnews] Regular expression scoring help?
#120607
Author: Murray Peterson
Date: Sat, 22 Feb 2003 17:40
45 lines
2705 bytes
Tech Zero <spamail@dragonfur.ca> wrote in
news:Xns932A364597E68Insomniac@130.133.1.4: 

> The voice of "Murray Peterson" drifted in on the cyber-winds, 
> from the sea of virtual chaos...
> 
>> Say X is 50, this will kill any subject that length or longer that
>> has no space character (which is what I assume you want):
>> 
>> Score:: -9999
>> Subject: [^ ]{50,}
> 
> 
> That would kill the first post, but not the replies.
> 
> Then again, it looks like your looking for post that doesn't contain a
> space in the first 50 or more characters.

Actually, that expression does not look for the "first" part at all -- it 
is merely matching any string of length X that contains no space character.  
Are you confusing the "^" with its other use?

> Since the value of "X" (50)
> in that entry is immaterial, setting it to say 20 is just as safe.

I was merely using 50 as an example value.  20 would certainly qualify as 
another exemplary value.
 
> Another way to do it would be to use the "non space" wildcard along
> with a possible starts with "Re: ". This will catch all replies as
> well unless they change the subject:
> 
>   Score: -9999
>     Subject: ^(Re: )?\S{20,}

No need to match the "Re:", since it is irrelevant to the match.  The rule:
    	Score:: -9999
    	Subject: \S{20,}
is simpler and works for replies as well as originals.

-- 
Murray Peterson
Email: murray_peterson@shaw.ca (remove underscore)
URL:   http://members.shaw.ca/murraypeterson/
Re: [Xnews] Regular expression scoring help?
#120703
Author: Tech Zero
Date: Sun, 23 Feb 2003 23:30
33 lines
2090 bytes
The voice of "Murray Peterson" drifted in on the cyber-winds, 
from the sea of virtual chaos...

>> Another way to do it would be to use the "non space" wildcard
>> along with a possible starts with "Re: ". This will catch all
>> replies as well unless they change the subject:
>> 
>>   Score: -9999
>>     Subject: ^(Re: )?\S{20,}
> 
> No need to match the "Re:", since it is irrelevant to the match. 
> The rule: 
>          Score:: -9999
>          Subject: \S{20,}
> is simpler and works for replies as well as originals.


We're both right in this case. "Re: " is only relative to the score if 
you looking from the start of the string, like my suggestion is....

There is a higher probability of getting a false hit by looking for a 
string of characters anywhere in the subject header. If that happens 
it's a simple matter of upping the x value thou.

Coodo's Murry... Just goes to show I don't know everything yet...

-- 
The Tech Zero, Maxwell C.G. Pollare

Helpful Xnews Links:
* http://www.slyck.com/xnews.html  http://www.seegras.de/xnews     *
* http://www.geocities.com/d4vidb/ http://xnews.newsguy.com/sizer/ *
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads