Created on 05-28-2010 05:21 PM Edited on 05-26-2022 09:31 AM By Anonymous
Description
American ExpressFirst two digits will be 34 or 37.
Total length will be 15 digits.VisaFirst digit will be 4.Total length will be either 13 or 16 digits (depends on card type).Master CardFirst digit will be 5.Second digit will be from 1 to 5 (inclusive).Total length will be 16 digits.
Amex: 3[47]\d{2}([ \-]?)\d{6}([ \-]?)\d{5}
Mastercard: 5[1-5]\d{2}([ \-]?)(\d{4})([ \-]?)(\d{4})([ \-]?)(\d{4})
Visa (13 digits): 4\\d{3}([ \-]?)(\d{4})([ \-]?)(\d{4})
Visa (16 digits :( 4\d{3}([ \-]?)(\d{4})([ \-]?)(\d{4})([ \-]?)(\d{4})
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
Scope
FortiMail v4.0 and above.
Solution
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.