cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
641
Views
0
Helpful
4
Replies

Regex string for SMTP command

rrutledge
Level 1
Level 1

Hi Everyone,

I would like to create a signature to look for SMTP "command mail from:<>". Is this the right regex statement to look for this traffic?

[Mm][Aa][Ii][Ll] [Ff][Rr][Oo][Mm][:][<>]

1 Accepted Solution

Accepted Solutions

wsulym
Cisco Employee
Cisco Employee

I usually use the hex equivalent of the space, but that's just personal preference as it makes it easier to read to me (and i don't inadvertently add random spaces where I don't want them).

[Mm][Aa][Ii][Ll]\x20[Ff][Rr][Oo][Mm][:][<>]

Realize that [<>] is a character class and means "<" or ">" in that spot, so the regex you propose would match:

mail from:<

or

mail from:>

If you wanted to find:

mail from:<> (no value in between the braces) then the following:

[Mm][Aa][Ii][Ll]\x20[Ff][Rr][Oo][Mm][:][<][>]

View solution in original post

4 Replies 4

wsulym
Cisco Employee
Cisco Employee

I usually use the hex equivalent of the space, but that's just personal preference as it makes it easier to read to me (and i don't inadvertently add random spaces where I don't want them).

[Mm][Aa][Ii][Ll]\x20[Ff][Rr][Oo][Mm][:][<>]

Realize that [<>] is a character class and means "<" or ">" in that spot, so the regex you propose would match:

mail from:<

or

mail from:>

If you wanted to find:

mail from:<> (no value in between the braces) then the following:

[Mm][Aa][Ii][Ll]\x20[Ff][Rr][Oo][Mm][:][<][>]

Thanks

Already got serveral hits

mhellman
Level 7
Level 7

Do you mean you're looking for the SMTP "mail from:" command following by empty brackets? That's close but not quite right.

[Mm][Aa][Ii][Ll][ \t]*[Ff][Rr][Oo][Mm][:][ \t]*[<][>]

I believe different mail servers allow different behavior, so you might be able to get rid of the "[ \t]*" sections if you know how your mail server behaves.

Review Cisco Networking products for a $25 gift card