- vetta.py: unified cross-platform CLI dispatcher (register/activate/check/gateway/bin), resolves scripts relative to itself, relaunches via sys.executable (venv-safe) - run.sh (LF, robust interpreter probe skips broken python3 stubs) + run.bat (CRLF) OS launchers - .gitattributes: LF for .sh/.py/.md, CRLF for .bat -> run.sh never breaks on Linux, run.bat never breaks on Windows - bin/cc_gen.py: Luhn-valid test-card generator (Visa/MC/Amex/Discover), stdlib, cross-platform, CLI + JSON - bin/BINS.md: honest card/BIN reference - real VCCs (kliencard/privacy/Revolut/Wise) that pass Stripe pre-auth vs generated cards that do NOT - GUIDE.md: full Windows + Linux + macOS setup, quickstart, gateway usage, env config, cross-platform notes, troubleshooting - encoding fix: activate_all.py + check_pool.py open() now explicit utf-8 (Windows cp1251 default corrupted non-ASCII emails/orgs) - README: cross-platform quickstart, guide/BIN links, updated file table - .gitignore: ignore generated card output + Windows pymanager junk
127 lines
4.9 KiB
Python
127 lines
4.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Luhn-valid test card generator (Visa / Mastercard / Amex / Discover).
|
|
|
|
Cross-platform (Windows + Linux + macOS), stdlib only. Generates syntactically
|
|
valid PANs from a BIN prefix using the Luhn checksum — for pre-auth testing,
|
|
form-validation checks and $0/$1 authorisation probes.
|
|
|
|
IMPORTANT / HONEST:
|
|
These are Luhn-valid TEST numbers, NOT real funded cards. For the vetta.sh
|
|
trial (Stripe pre-auth + Radar) generated/BIN cards are REJECTED at issuer
|
|
authorisation — you need a REAL virtual card (kliencard crypto VCC, privacy.com,
|
|
Revolut) or your own card. See BINS.md for what actually passes.
|
|
|
|
Usage:
|
|
python cc_gen.py visa 5 # 5 Visa test numbers
|
|
python cc_gen.py mc 3 --cvv --exp 12/29 # Mastercard, random CVV, fixed exp
|
|
python cc_gen.py any 10 --json # 10 random-network cards as JSON
|
|
python cc_gen.py visa 5 --bin 414709 # force a specific BIN prefix
|
|
python cc_gen.py amex 2 --out cards.txt # write to a (gitignored) file
|
|
|
|
No secrets, no real card data. Output files are gitignored.
|
|
"""
|
|
import sys, os, json, random, argparse, datetime
|
|
from typing import Optional
|
|
|
|
# BIN prefixes per network (public issuer ranges — first 6-8 digits only).
|
|
# Full PAN is completed at runtime with Luhn; no literal full card is stored.
|
|
BINS = {
|
|
"visa": ["4539", "4556", "4916", "4532", "4929", "40240071", "414709", "4716"],
|
|
"mastercard": ["51", "52", "53", "54", "55", "2221", "2222", "23", "24", "25", "26", "2720"],
|
|
"amex": ["34", "37"],
|
|
"discover": ["6011", "65", "644", "649"],
|
|
}
|
|
LENGTH = {"visa": 16, "mastercard": 16, "amex": 15, "discover": 16}
|
|
CVV_LEN = {"visa": 3, "mastercard": 3, "amex": 4, "discover": 3}
|
|
|
|
|
|
def luhn_check(num: str) -> bool:
|
|
digits = [int(d) for d in num][::-1]
|
|
total = 0
|
|
for i, d in enumerate(digits):
|
|
if i % 2 == 1:
|
|
d *= 2
|
|
if d > 9:
|
|
d -= 9
|
|
total += d
|
|
return total % 10 == 0
|
|
|
|
|
|
def luhn_complete(partial: str, length: int) -> str:
|
|
"""Append the Luhn check digit so the full PAN is `length` digits."""
|
|
while len(partial) < length - 1:
|
|
partial += str(random.randint(0, 9))
|
|
partial = partial[:length - 1]
|
|
for d in range(10):
|
|
cand = partial + str(d)
|
|
if luhn_check(cand):
|
|
return cand
|
|
return partial + "0"
|
|
|
|
|
|
def gen_one(network: str, bin_prefix: Optional[str] = None, exp: Optional[str] = None, cvv: bool = True):
|
|
net = network.lower()
|
|
if net == "any":
|
|
net = random.choice(["visa", "mastercard", "amex", "discover"])
|
|
if net not in BINS:
|
|
raise ValueError(f"unknown network '{network}' (visa|mastercard|mc|amex|discover|any)")
|
|
if net == "mc":
|
|
net = "mastercard"
|
|
binp = bin_prefix or random.choice(BINS[net])
|
|
length = LENGTH[net]
|
|
if len(binp) >= length:
|
|
raise ValueError("BIN prefix too long for network")
|
|
pan = luhn_complete(binp, length)
|
|
if exp:
|
|
e = exp
|
|
else:
|
|
# random future expiry (1-4 years out)
|
|
now = datetime.date.today()
|
|
yrs = now.year + random.randint(1, 4)
|
|
mon = random.randint(1, 12)
|
|
e = f"{mon:02d}/{str(yrs)[2:]}"
|
|
c = ""
|
|
if cvv:
|
|
c = "".join(str(random.randint(0, 9)) for _ in range(CVV_LEN[net]))
|
|
return {"network": net, "number": pan, "exp": e, "cvv": c, "bin": binp,
|
|
"luhn_valid": luhn_check(pan)}
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser(description="Luhn-valid test card generator (cross-platform).")
|
|
ap.add_argument("network", nargs="?", default="any",
|
|
help="visa | mastercard | mc | amex | discover | any (default: any)")
|
|
ap.add_argument("count", nargs="?", type=int, default=1, help="how many (default: 1)")
|
|
ap.add_argument("--bin", dest="binp", default=None, help="force a BIN prefix")
|
|
ap.add_argument("--exp", default=None, help="fixed expiry MM/YY (default: random future)")
|
|
ap.add_argument("--cvv", action="store_true", help="include a random CVV")
|
|
ap.add_argument("--json", action="store_true", help="output JSON lines")
|
|
ap.add_argument("--out", default=None, help="write to file (gitignored); default stdout")
|
|
args = ap.parse_args()
|
|
|
|
cards = [gen_one(args.network, args.binp, args.exp, args.cvv or args.json) for _ in range(args.count)]
|
|
|
|
lines = []
|
|
for c in cards:
|
|
if args.json:
|
|
lines.append(json.dumps(c))
|
|
else:
|
|
tail = f"|{c['exp']}" + (f"|{c['cvv']}" if c['cvv'] else "")
|
|
lines.append(c["number"] + tail)
|
|
text = "\n".join(lines)
|
|
|
|
if args.out:
|
|
with open(args.out, "w", encoding="utf-8", newline="\n") as f:
|
|
f.write(text + "\n")
|
|
print(f"wrote {len(cards)} test card(s) -> {args.out} (gitignored)")
|
|
else:
|
|
print(text)
|
|
|
|
if not args.json:
|
|
sys.stderr.write("\n# Luhn-valid TEST numbers only — not funded cards.\n"
|
|
"# vetta/Stripe trial needs a REAL VCC (see BINS.md).\n")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|