I update a file with regexes for postfix to do body_checks on whenever a piece of spam makes it through my spam blocking techniques. This way, similar messages will not get through in the future. I've had some difficulty, mainly with the message being received different than it's displayed in a mail client. Therefore I use [cmd=]tcpdump -s0 -i lo0 -w blah.tcp[/cmd] to capture the information as I forward the spam to another account on the machine (lo0 to circumvent the TLS encryption present on the external interface), and then examine the capture to see multiple embedded spaces (displayed as one by Thunderbird), newline characters, etc. I've run into one that I can't seem to figure out why the regular expression isn't hitting on though.
The original message:
This is completely despicable IMO, as Sgt. Ryan Green was killed in Iraq.
x(
I decided to key on the first line of the message, which contains both improper use of commas and an extra space between 'am' and 'serving'.
I do a packet capture:
And the regular expression I created (with added CRs to prevent it from horizontally scrolling the page):
This should hit as far as I can tell, but I can forward the same message to another account on my mail server and it goes right through. Does anybody see where I've gone wrong?
The original message:
Code:
Dear Sir/madam,
My name is Sergeant Ryan Green, I am an American soldier, I am serving in the
military of the 1st Armoured Division in Iraq, as you know we are being attacked
by insurgents everyday and car bombs. We managed to move funds belonging
to Saddam Hussein?s family.
The total amount is US$25 Million dollars in cash, mostly 100 dollar bills. We
want to move this money to you, so that you may invest it for us and keep our
share for banking. You can go to this web link to read about events that took
place there: http://news.bbc.co.uk/2/hi/middle_east/2988455.stm We will take
70%, my partner and I. You take the other 30%. No strings attached, just help us
move it out of Iraq, Iraq is a war zone.
We plan on using diplomatic courier and shipping the money out in one large
silver box, using diplomatic immunity. If you are interested I will send you the
full details, my job is to find a good partner that we can trust and that will assist
us.
Can I trust you? When you receive this mail, kindly send me an e-mail
signifying your interest.
This business is risk free. The box can be shipped out in 48hrs if you will be
ready to assist us.
Yours faithfully,
Sergeant Ryan Green.
This is completely despicable IMO, as Sgt. Ryan Green was killed in Iraq.


I do a packet capture:
Code:
0830 0d 0a 0d 0a 44 65 61 72 20 53 69 72 2f 6d 61 64 ....Dear Sir/mad
0840 61 6d 2c 0d 0a 0d 0a 4d 79 20 6e 61 6d 65 20 69 am,....My name i
0850 73 20 53 65 72 67 65 61 6e 74 20 52 79 61 6e 20 s Sergeant Ryan
0860 47 72 65 65 6e 2c 20 49 20 61 6d 20 61 6e 20 41 Green, I am an A
0870 6d 65 72 69 63 61 6e 20 73 6f 6c 64 69 65 72 2c merican soldier,
0880 20 49 20 61 6d 20 20 73 65 72 76 69 6e 67 0d 0a I am serving..
0890 69 6e 20 74 68 65 0d 0a 6d 69 6c 69 74 61 72 79 in the..military
08a0 20 6f 66 20 74 68 65 20 31 73 74 20 41 72 6d 6f of the 1st Armo
08b0 75 72 65 64 20 44 69 76 69 73 69 6f 6e 20 69 6e ured Division in
08c0 20 49 72 61 71 2c 20 20 61 73 20 79 6f 75 20 6b Iraq, as you k
08d0 6e 6f 77 20 77 65 20 61 72 65 20 62 65 69 6e 67 now we are being
08e0 0d 0a 61 74 74 61 63 6b 65 64 0d 0a 62 79 20 69 ..attacked..by i
08f0 6e 73 75 72 67 65 6e 74 73 20 65 76 65 72 79 64 nsurgents everyd
0900 61 79 20 61 6e 64 20 20 63 61 72 20 62 6f 6d 62 ay and car bomb
0910 73 2e 20 57 65 20 6d 61 6e 61 67 65 64 20 74 6f s. We managed to
0920 20 6d 6f 76 65 20 66 75 6e 64 73 20 62 65 6c 6f move funds belo
0930 6e 67 69 6e 67 0d 0a 74 6f 20 53 61 64 64 61 6d nging..to Saddam
0940 20 48 75 73 73 65 69 6e 3f 73 20 66 61 6d 69 6c Hussein?s famil
0950 79 2e 0d 0a 0d 0a 54 68 65 20 74 6f 74 61 6c 20 y.....The total
0960 61 6d 6f 75 6e 74 20 69 73 20 55 53 24 32 35 20 amount is US$25
And the regular expression I created (with added CRs to prevent it from horizontally scrolling the page):
Code:
/^My name is Sergeant Ryan Green\, I am an American soldier\, I am serving$/ REJECT
Trying to scam somebody by impersonating a deceased soldier is without class. BC14
This should hit as far as I can tell, but I can forward the same message to another account on my mail server and it goes right through. Does anybody see where I've gone wrong?