home *** CD-ROM | disk | FTP | other *** search
/ ftp.f-secure.com / 2014.06.ftp.f-secure.com.tar / ftp.f-secure.com / support / hotfix / fsis / IS-SpamControl.fsfix / iufssc / rules / 20_body_tests.cf < prev    next >
Text File  |  2006-11-29  |  7KB  |  148 lines

  1. # SpamAssassin rules file: body tests
  2. #
  3. # Please don't modify this file as your changes will be overwritten with
  4. # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
  5. # See 'perldoc Mail::SpamAssassin::Conf' for details.
  6. #
  7. # Note: body tests are run with long lines, so be sure to limit the
  8. # size of searches; use /.{0,30}/ instead of /.*/ to avoid huge
  9. # search times.
  10. #
  11. # Note: If you are adding a rule which looks for a phrase in the body
  12. # (as most of them do), please add it to rules/20_phrases.cf instead.
  13. #
  14. # <@LICENSE>
  15. # Copyright 2004 Apache Software Foundation
  16. # Licensed under the Apache License, Version 2.0 (the "License");
  17. # you may not use this file except in compliance with the License.
  18. # You may obtain a copy of the License at
  19. #     http://www.apache.org/licenses/LICENSE-2.0
  20. # Unless required by applicable law or agreed to in writing, software
  21. # distributed under the License is distributed on an "AS IS" BASIS,
  22. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. # See the License for the specific language governing permissions and
  24. # limitations under the License.
  25. # </@LICENSE>
  26. #
  27. ###########################################################################
  28.  
  29. #require_version @@VERSION@@
  30.  
  31. ###########################################################################
  32. # GTUBE test - the generic test for UBE.
  33. body GTUBE        /XJS\*C4JDBQADN1\.NSBN3\*2IDNEN\*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL\*C\.34X/
  34. describe GTUBE        Generic Test for Unsolicited Bulk Email
  35. tflags GTUBE        userconf noautolearn
  36.  
  37. ###########################################################################
  38.  
  39. # this seems to be the new fashion (as of Jul 5 2002).  base64-encoded
  40. # parts need to be stripped before this match
  41. body TRACKER_ID        /^[a-z0-9]{6,24}[-_a-z0-9]{12,36}[a-z0-9]{6,24}\s*\z/is
  42. describe TRACKER_ID    Incorporates a tracking ID number
  43.  
  44. body WEIRD_QUOTING    /[\042\223\224\262\263\271]{2}\S{0,16}[\042\223\224\262\263\271]{2}/
  45. describe WEIRD_QUOTING    Weird repeated double-quotation marks
  46.  
  47. ###########################################################################
  48. # these tests doesn't actually use rawbody since rawbody isn't raw enough;
  49. # they must be written very carefully to avoid modifying the original content
  50.  
  51. # MIME Content-Transfer-Encoding control rules
  52. rawbody __MIME_BASE64        eval:check_for_mime('mime_base64_count')
  53. describe __MIME_BASE64        Includes a base64 attachment
  54.  
  55. rawbody __MIME_QP        eval:check_for_mime('mime_qp_count')
  56. describe __MIME_QP        Includes a quoted-printable attachment
  57.  
  58. rawbody MIME_BASE64_BLANKS    eval:check_for_mime('mime_base64_blanks')
  59. describe MIME_BASE64_BLANKS    Extra blank lines in base64 encoding
  60.  
  61. rawbody MIME_BASE64_NO_NAME    eval:check_for_mime('mime_base64_no_name')
  62. describe MIME_BASE64_NO_NAME    base64 attachment does not have a file name
  63.  
  64. rawbody MIME_BASE64_TEXT    eval:check_for_mime('mime_base64_encoded_text')
  65. describe MIME_BASE64_TEXT    Message text disguised using base64 encoding
  66.  
  67. rawbody  MIME_MISSING_BOUNDARY    eval:check_for_mime('mime_missing_boundary')
  68. describe MIME_MISSING_BOUNDARY    MIME section missing boundary
  69.  
  70. body MISSING_MIME_HB_SEP    eval:check_msg_parse_flags('missing_mime_head_body_separator')
  71. describe MISSING_MIME_HB_SEP    Missing blank line between MIME header and body
  72.  
  73. body MIME_HTML_MOSTLY        eval:check_mime_multipart_ratio('0.00','0.01')
  74. describe MIME_HTML_MOSTLY    Multipart message mostly text/html MIME
  75.  
  76. # Steve Linford via Charlie Watts: good test!
  77. body MIME_HTML_ONLY        eval:check_for_mime_html_only()
  78. describe MIME_HTML_ONLY        Message only has text/html MIME parts
  79.  
  80. # multipart/alternative has very good accuracy, other multipart types are
  81. # similar to MIME_HTML_ONLY so they don't need a separate rule
  82. header __CTYPE_MULTIPART_ALT    Content-Type =~ /multipart\/alternative/i
  83. meta MIME_HTML_ONLY_MULTI    (__CTYPE_MULTIPART_ALT && MIME_HTML_ONLY)
  84. describe MIME_HTML_ONLY_MULTI    Multipart message only has text/html MIME parts
  85.  
  86. rawbody  MIME_QP_LONG_LINE    eval:check_for_mime('mime_qp_long_line')
  87. describe MIME_QP_LONG_LINE    Quoted-printable line longer than 76 chars
  88.  
  89. # note: __HIGHBITS is used by HTML_CHARSET_FARAWAY
  90. rawbody __MIME_CHARSET_FARAWAY    eval:check_for_mime('mime_faraway_charset')
  91. body __HIGHBITS            /(?:[\x80-\xff].?){4}/
  92. meta MIME_CHARSET_FARAWAY    (__MIME_CHARSET_FARAWAY && __HIGHBITS)
  93. describe MIME_CHARSET_FARAWAY    MIME character set indicates foreign language
  94. tflags MIME_CHARSET_FARAWAY    userconf
  95.  
  96. # This rule uses a simple algorithm to determine if the text and html
  97. # parts of an multipart/alternative message are different.
  98. body MPART_ALT_DIFF    eval:multipart_alternative_difference('99', '100')
  99. describe MPART_ALT_DIFF    HTML and text parts are different
  100.  
  101. body MPART_ALT_DIFF_COUNT    eval:multipart_alternative_difference_count('3', '1')
  102. describe MPART_ALT_DIFF_COUNT    HTML and text parts are different
  103.  
  104. body MIME_BAD_ISO_CHARSET    eval:check_for_mime('mime_bad_iso_charset')
  105. describe MIME_BAD_ISO_CHARSET    MIME character set is an unknown ISO charset
  106.  
  107. ###########################################################################
  108.  
  109. body CHARSET_FARAWAY        eval:check_for_faraway_charset()
  110. describe CHARSET_FARAWAY    Character set indicates a foreign language
  111. tflags CHARSET_FARAWAY        userconf
  112.  
  113. # duncf
  114. body EMAIL_ROT13     /\b[a-z(\]-]+\^[a-z-]+\([a-z]{2,3}\b/
  115. describe EMAIL_ROT13 Body contains a ROT13-encoded email address
  116. test EMAIL_ROT13 ok  qhabs^ebtref(pbz
  117. test EMAIL_ROT13 ok  zxrggyre^riv-vap(pbz
  118. test EMAIL_ROT13 fail    duncf-nospam@rogers.com
  119.  
  120. body BLANK_LINES_70_80    eval:check_blank_line_ratio('70','80','4')
  121. body BLANK_LINES_80_90    eval:check_blank_line_ratio('80','90','4')
  122. body BLANK_LINES_90_100    eval:check_blank_line_ratio('90','100','4')
  123. describe BLANK_LINES_70_80  Message body has 70-80% blank lines
  124. describe BLANK_LINES_80_90  Message body has 80-90% blank lines
  125. describe BLANK_LINES_90_100 Message body has 90-100% blank lines
  126.  
  127. body UNIQUE_WORDS    eval:check_unique_words('0.946', '3.1')
  128. describe UNIQUE_WORDS    Message body has many words used only once
  129.  
  130. body DOMAIN_RATIO    eval:check_domain_ratio('0.022')
  131. describe DOMAIN_RATIO    Message body mentions many internet domains
  132.  
  133. # this could use more work
  134. body __LONGWORDS_A    /\b(?:[a-z]{8,}[\s\.]+){6}/
  135. body __LONGWORDS_B    /\b(?:[a-z]{6,}[\s\.]+){9}/
  136. body __LONGWORDS_C    /\b(?:[a-z]{5,}[\s\.]+){10}/
  137. meta LONGWORDS        (__LONGWORDS_A + __LONGWORDS_B + __LONGWORDS_C > 1)
  138. describe LONGWORDS    Long string of long words
  139.  
  140. body HTTPS_IP_MISMATCH    eval:check_https_ip_mismatch()
  141. describe HTTPS_IP_MISMATCH    IP to HTTPS link found in HTML
  142.  
  143. rawbody INTERRUPTUS           /(?:[a-zA-Z0-9]<[\/ ]{0,2}?(?!br)(?!p)(?!sup)(?!li)(?!b)(?!i)(?!option)(?!a (?:href|name))(?:\b|!--)[^>]{0,64}?>[a-zA-Z0-9].{0,64}){3}/i
  144. describe INTERRUPTUS          Message looks to contain HTML-interrupted text
  145.