Mailing List Archive

number in sender name
Using SpamAssassin 3.4.5 (2021-03-20)

Perhaps memory fails, but was there not, once, a standard rule that detected non alpha characters in
sender name? The domain/provider is not of interest for this question.

Such as this item (not the actual sender name)

* 1.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
* provider
* [abcd531if7[at]gmail.com]

Thanks.
Re: number in sender name [ In reply to ]
> Perhaps memory fails, but was there not, once, a standard rule that
> detected non alpha characters in
sender name? The domain/provider is not of interest for this question.

I think there was, but I suspect that the spam/ham ratio would be about
even, which is probably why it doesn't show up now.
Re: number in sender name [ In reply to ]
Anyone have a regex example handy that can detect any number of digits before @ sign?
Not a regex maven at all. What searching I did on this topic just served to kick the bee hive.


>> Perhaps memory fails, but was there not, once, a standard rule that
>> detected non alpha characters in
> sender name? The domain/provider is not of interest for this question.
>
> I think there was, but I suspect that the spam/ham ratio would be about
> even, which is probably why it doesn't show up now.
Re: number in sender name [ In reply to ]
On 2021-07-10 at 12:31:13 UTC-0400 (Sat, 10 Jul 2021 12:31:13 -0400)
Joe Acquisto-j4 <joea@j4computers.com>
is rumored to have said:

> Anyone have a regex example handy that can detect any number of digits
> before @ sign?

/[0-9]+\@/



> Not a regex maven at all. What searching I did on this topic just
> served to kick the bee hive.
>
>
>>> Perhaps memory fails, but was there not, once, a standard rule that
>>> detected non alpha characters in
>> sender name? The domain/provider is not of interest for this
>> question.
>>
>> I think there was, but I suspect that the spam/ham ratio would be
>> about
>> even, which is probably why it doesn't show up now.


--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
Re: number in sender name [ In reply to ]
On 10.07.21 12:31, Joe Acquisto-j4 wrote:
>Anyone have a regex example handy that can detect any number of digits before @ sign?
>Not a regex maven at all. What searching I did on this topic just served to kick the bee hive.

maybe it helps:

header FROM_LOCAL_DIGITS From =~ /\d{11}\S*\@/i
describe FROM_LOCAL_DIGITS From: localpart has long digit sequence

header FROM_LOCAL_HEX From =~ /[0-9a-f]{11}\S*\@/i
describe FROM_LOCAL_HEX From: localpart has long hexadecimal sequence


--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Atheism is a non-prophet organization.
Re: number in sender name [ In reply to ]
On Sat, 10 Jul 2021, Joe Acquisto-j4 wrote:

> Using SpamAssassin 3.4.5 (2021-03-20)
>
> Perhaps memory fails, but was there not, once, a standard rule that detected non alpha characters in
> sender name? The domain/provider is not of interest for this question.
>
> Such as this item (not the actual sender name)
>
> * 1.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
> * provider
> * [abcd531if7[at]gmail.com]


https://ruleqa.spamassassin.org/20210709-r1891395-n/__FROM_ENDS_IN_NUMS/detail

It's not currently used in any scored base rules, though.

Related base rules:

FROM_STARTS_WITH_NUMS
__FROM_ALL_NUMS
__TO_ALL_NUMS
__FM_TO_ALL_NUMS

--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
Back in 1969 the technology to fake a Moon landing didn't exist,
but the technology to actually land there did.
Today, it is the opposite. -- unknown
-----------------------------------------------------------------------
10 days until the 52nd anniversary of Apollo 11 landing on the Moon
Re: number in sender name [ In reply to ]
Not a direct reply, but:

If you have a copy of "The Camel Book", otherwise known as "Programming
Perl" by Larry Wall, Tom Christiansen & John Orwant" pub. O'reilly, or
know somebody who has a copy, have a read of Chapter 5 'Pattern
Matching' which contains about the clearest explanation of how regexes
work and how to write them that I've seen anywhere - and better yet, it
describes Perl regexes, which is what SA uses. 

FWIW there are also C and Java regex dialects, which are not at all
useful in SA rules.

https://www.regular-expressions.info/ is also useful.

Its worth knowing about these too:
https://www.regexplanet.com/advanced/java/index.html
https://regex101.com/

They are both pages for testing regexes: both let you type in a regex
plus test strings to check whether the regex does what you expect - or
not!

Martin
Re: number in sender name [ In reply to ]
Martin Gregorie wrote:
> Not a direct reply, but:
>
> If you have a copy of "The Camel Book", otherwise known as "Programming
> Perl" by Larry Wall, Tom Christiansen & John Orwant" pub. O'reilly, or
> know somebody who has a copy, have a read of Chapter 5 'Pattern
> Matching' which contains about the clearest explanation of how regexes
> work and how to write them that I've seen anywhere - and better yet, it
> describes Perl regexes, which is what SA uses.
>
> FWIW there are also C and Java regex dialects, which are not at all
> useful in SA rules.
>
> https://www.regular-expressions.info/ is also useful.
>
> Its worth knowing about these too:
> https://www.regexplanet.com/advanced/java/index.html
> https://regex101.com/
>
> They are both pages for testing regexes: both let you type in a regex
> plus test strings to check whether the regex does what you expect - or
> not!
>
> Martin
>
>

The CHAOS.pm module has an eval: from_no_vowels that may do the job as
well.  Like most of the stuff in there it has internationalization so
that vowels in other language character sets are taken into account.

This looks at the From Name field.

$0.02,

-- Jared Hall
Re: number in sender name [ In reply to ]
Thanks for all the solutions and suggestions.

joe a.

> Anyone have a regex example handy that can detect any number of digits before
> @ sign?
> Not a regex maven at all. What searching I did on this topic just served to
> kick the bee hive.
>
>
Perhaps memory fails, but was there not, once, a standard rule that
>>> detected non alpha characters in
>> sender name? The domain/provider is not of interest for this question.
>>
>> I think there was, but I suspect that the spam/ham ratio would be about
>> even, which is probably why it doesn't show up now.
Re: number in sender name [ In reply to ]
Martin Gregorie wrote:
> If you have a copy of "The Camel Book", otherwise known as "Programming
> Perl" by Larry Wall, Tom Christiansen & John Orwant" pub. O'reilly, or
> know somebody who has a copy, have a read of Chapter 5 'Pattern
> Matching' which contains about the clearest explanation of how regexes
> work and how to write them that I've seen anywhere - and better yet, it
> describes Perl regexes, which is what SA uses.

Martin,

My version of The Camel, admittedly the 2nd edition from 1996, has
chapter 5 as Packages, Modules, and Object Classes.  Section 2.4,
however, is a detailed section on Regular Expressions.  Is that the one
you meant because I'd like to reference it correctly along with your
other great advice.  Is it Chapter 5 in another edition?

Regards,
KAM

--
Kevin A. McGrail
KMcGrail@Apache.org

Member, Apache Software Foundation
Chair Emeritus Apache SpamAssassin Project
https://www.linkedin.com/in/kmcgrail - 703.798.0171
Re: number in sender name [ In reply to ]
You're right: my copy of the Camel book is the Third edition, from 2000.
The cover has a corner tagged with 'revised and updated'. The 4th
edition was released on 2012. 

It covers Perl 5.6 with the title changed to 
"Programming Perl: Unmatched power for text processing and scripting" 

and also covers:

New keywords and syntax
I/O layers and encodings
New backslash escapes
Unicode 6.0
Unicode grapheme clusters and properties
Named captures in regexes
Recursive and grammatical patterns
Expanded coverage of CPAN
Current best practices

so is probably worth having if you write a lot of Perl code. Disclosure:
I write mostly C and Java with a little bash and awk on the side, so
value having a comprehensive book like the Camel to hand if I need it.

BTW, the online regex development page URLs I gave were working as
expected at the time I wrote that note.

Martin


On Sun, 2021-07-11 at 11:17 -0400, Kevin A. McGrail wrote:
>
> Martin Gregorie wrote:
> > If you have a copy of "The Camel Book", otherwise known as
> > "Programming
> > Perl" by Larry Wall, Tom Christiansen & John Orwant"  pub. O'reilly,
> > or
> > know somebody who has a copy, have a read of Chapter 5 'Pattern
> > Matching' which contains about the clearest explanation of how regexes
> > work and how to write them that I've seen anywhere - and better yet,
> > it
> > describes Perl regexes, which is what SA uses.
>
> Martin,
>
> My version of The Camel, admittedly the 2nd edition from 1996, has
> chapter 5 as Packages, Modules, and Object Classes.  Section 2.4,
> however, is a detailed section on Regular Expressions.  Is that the one
> you meant because I'd like to reference it correctly along with your
> other great advice.  Is it Chapter 5 in another edition?
>
> Regards,
> KAM
>
Re: number in sender name [ In reply to ]
On Sun, 11 Jul 2021, Martin Gregorie wrote:

> BTW, the online regex development page URLs I gave were working as
> expected at the time I wrote that note.

I second those resources, especially regex101.com - it has a visual
debugger that will step through the pattern matching process. It's *very*
helpful when you just can't figure out why the RE is failing.

--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
What the hell is an "Aluminum Falcon"?? -- Emperor Palpatine
-----------------------------------------------------------------------
9 days until the 52nd anniversary of Apollo 11 landing on the Moon