Search for AMEX Credit Card Numbers
Following is a simple .audit
file that looks for a list of file types that contain a properly formatted AMEX credit card number.
<item>
type: FILE_CONTENT_CHECK
file_extension: 'pdf', 'doc', 'xls', 'xlsx', 'xlsm', 'xlsb', 'xml', 'xltx', 'xltm', 'docx', 'docm', 'dotx', 'dot', 'txt'
exclude_paths: '/root/unix_file_content_test_files/non'
regex: ([^0-9-]|^)([0-9]{3}-[0-9]{2}-[0-9]{4})([^0-9-]|$)
regex_replace: \3
only_show: 4
expect: 'American Express', 'CCAX', 'amex', 'credit', 'AMEX', 'CCN'
max_size: 51200
</item>
The output we get this time is as follows:
No files were found to be in violation.
We were able to “pass” the audit because none of the files we audited contained an AMEX credit card number.