A fast, reliable Python command-line utility designed to filter large datasets of credit card numbers against a verified list of Bank Identification Numbers (BINs).
This tool is particularly useful for Fraud and Threat Intelligence teams who need to rapidly triage and cross-reference leaked BIN numbers on a daily basis. It is ideal for data cleaning, allowing you to easily extract specific credit cards from bulk datasets while automatically handling duplicate entries and formatting artifacts.
You can run the script via the command line. To see the available commands at any time, use the help flag:
py BIN_Validator.py -hOutput:
usage: py BIN_Validator.py [-h] -b BINS -n NEW_CARDS [-o OUTPUT] [-e {txt,csv}]
Filter credit card numbers based on a list of Bank Identification Numbers (BINs).
options:
-h, --help show this help message and exit
-b, --bins BINS Path to the input file containing BINS (Source of Truth). Supports .txt and .csv
-n, --new_cards NEW_CARDS
Path to the input file containing new cards to check. Supports .txt and .csv
-o, --output OUTPUT Path to the output file. Defaults to cards_DD_MM_YYYY.[txt/csv]
-e, --export_format {txt,csv}
Format for the output file (txt or csv). Default is txt.
To filter a list of new cards against your known BINs, provide the paths to both files.
Note: After the
-bflag, you must add the path of the file containing all our BINs. After the-nflag, add the path to the file containing the cards you want to check.
py BIN_Validator.py -b all_BINs.txt -n new_cards.txtThis will process the cards and automatically generate a file named cards_DD_MM_YYYY.txt in your current directory.
If you prefer your results in a spreadsheet format, use the -e flag:
py BIN_Validator.py -b data/all_BINs.csv -n data/new_cards.txt -e csvThis outputs the matched cards to a .csv file.
You can specify exactly what you want the output file to be named using the -o flag:
py BIN_Validator.py -b all_BINs.txt -n new_cards.txt -o my_filtered_cards.csv -e csvEvery time you run the script, it will print a detailed report to your terminal so you can verify the results at a glance:
==================================================
BIN FILTER REPORT
==================================================
All BINs in our Inventory: 450
Where:
> 6 Digit BINs: 400
> 8 Digit BINs: 45
> 9 Digit BINs: 5
--------------------------------------------------
Total new cards scanned: 50000
Success! Found matching cards: 1250
==================================================
Results saved to: cards_21_11_2025.txt