Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CCNumGen is a Python 3.9+ class that uses the Luhn algorithm to generate theoretically valid credit card numbers with CVV and expiration dates.

License

NotificationsYou must be signed in to change notification settings

wcDogg/python-cc-num-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCNumGen is a Python 3.9 class that uses theLuhn Algorithm to generate theoretically valid credit card numbers with CVV and expiration dates.

  • It can generate Amex, Discover, MC, Visa 13, and Visa 16 cards.
  • It generates 3 or 4 digit CVV numbers, depending on the card type.
  • It generates an expiration date that is 1 to 3 years from today.
  • It prints each card to the console.
  • It captures cards in a list of dictionaries.

Adapted from:https://stackoverflow.com/questions/59232327/python-how-to-always-generate-valid-luhn-numbers

Do the numbers work?

These are theoretical cards meant for testing the pre-checks that happen on a payment screen before payment is submitted. This utility does not generate real-world card information. For example, real CSV numbers are generated using an algorithm tied to the card number and other data points - something this utility can't do.

Need different card numbers?

Sometimes for testing you need card numbers with specific prefixes.CCNumGen is easy to extend.

  • Name the new card type in theCCNumGen class ->card_types list.
  • Define the new card in theCC class ->CCDATA dictionary.

Usage

CCNumGen generates 5 types of cards. The second argument is the number of cards to generate.

amex = CCNumGen('amex', 2)discover = CCNumGen('discover', 2)mc = CCNumGen('mc', 2)visa13 = CCNumGen('visa13', 2)visa16 = CCNumGen('visa16', 2)

Each card is printed to the console.

---------------------------Type: amexNumber: 372672737435387CVV: 8483Exp: 09-2025---------------------------Type: discoverNumber: 60019219645956610CVV: 892Exp: 05-2023---------------------------Type: mcNumber: 5169546719828815CVV: 678Exp: 03-2023---------------------------Type: visa13Number: 4929291332548CVV: 328Exp: 08-2025---------------------------Type: visa16Number: 4165317319538881CVV: 106Exp: 05-2024---------------------------

Each card is stored in a list of dictionaries.

[  {    'cc_type': 'mc',     'cc_num': '5538992865196249',     'cc_cvv': '617',     'cc_exp': '09-2024'  },   {    'cc_type': 'mc',     'cc_num': '5191748311982485',     'cc_cvv': '434',     'cc_exp': '11-2023'    }]

To access the list directly:

print(amex.card_list)print(discover.card_list)print(mc.card_list)print(visa13.card_list)print(visa16.card_list)

To print the list to console:

amex.print_card_list()discover.print_card_list()mc.print_card_list()visa13.print_card_list()visa16.print_card_list()

Handy Info

CardLengthStarts WithCVV LenCVV Location
Visa 1313 digits4xx3Back - left of sig
Visa 1616 digits4xx3Back - left of sig
MasterCard16 digits51 or 553Back - left of sig
Amex15 digits34 or 374Front - above CC num
Discover16 digits60113Back - last 3, after acct num

About CVV Numbers

Other names:

  • CSC - Card Security Code
  • CID - Card Identification Number
  • CVC2 - Card Verification Code
  • CVV2 - Card Verification Value

What is it?

  • An anti-fraud measure used by CC companies worldwide.
  • A 3 or 4 digit number printed on the physical card - and not embossed.
  • Used for Card Not Present (CNP) transactions.
  • Different from the CVV1 that's encoded on track 2 of the magnetic strip - this is used for Card Present Transactions (CPT).

Generated with DES encryption using:

  • Pair of DES keys (CVKs)
  • Primary Account Number (PAN)
  • 4-digit Expiration Date.
  • 3-digit Service Code.
  • Other data

Amex:

  • Does have a 3 digit CID code on back of card.
  • Uses the 4 digit CVV number on front of card for CNP transactions.

About

CCNumGen is a Python 3.9+ class that uses the Luhn algorithm to generate theoretically valid credit card numbers with CVV and expiration dates.

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp