
Created on
05-28-2010
05:21 PM
Edited on
08-07-2024
04:23 AM
By
Anthony_E
Description
Scope
FortiMail v4.0 and above.
Solution
The total length will be 15 digits.
Create a dictionary and enable its use in either the antispam or Content Profiles using the following patterns:
Visa (13 digits): 4\\d{3}([ \-]?)(\d{4})([ \-]?)(\d{4})
Visa (16 digits :( 4\d{3}([ \-]?)(\d{4})([ \-]?)(\d{4})([ \-]?)(\d{4})
- Creating a dictionary entry for the American Express card number:
-
Dictionary Profile with entries for American Express, Visa, and Master Card card numbers:
Configuration example from the CLI ('\' is a control character, which is why it needs to be entered twice through the CLI).
config profile dictionary
edit CreditCard
config item
edit 1
set pattern "3[47]\d{2}([ \-]?)\d{6}([ \-]?)\d{5}"
set pattern-scan-area body
next
edit 2
set pattern "5[1-5]\\d{2}([ \\-]?)(\\d{4})([ \\-]?)(\\d{4})([ \\-]?)(\\d{4})"
set pattern-scan-area body
next
edit 3
set pattern "4\\d{3}([ \\-]?)(\\d{4})([ \\-]?)(\\d{4})"
set pattern-scan-area body
next
edit 4
set pattern "4\\d{3}([ \\-]?)(\\d{4})([ \\-]?)(\\d{4})([ \\-]?)(\\d{4})"
set pattern-scan-area body
next
end
next
end
This is a breakdown of what the expression is saying (for Amex detection).
Expression: 3[47]\d{2}([ \-]?)\d{6}([ \-]?)\d{5}.
3 --> The digit '3'.
[47] --> Followed by either a '4' or '7'.
\d{2} -->Followed by any 2 random digits.
([ \-]?) --> Optionally, followed by a hyphen.
\d{6} --> Followed by any 6 random digits.
([ \-]?) --> Optionally, followed by a hyphen.
\d{5} --> Followed by any 5 random digits.