def generateDebitCards(lott_num, vfm, vfy): dcNo = list("2200000000000000") vtm = vfm vty = vfy + 5 # print(dcNo) lott=int(lott_num) lot=lott dcNoArr = [dcNo] * 10000 list1 = [4,8,12,5,9,13,3,7,11] for j in range(0,10000): for i in list1: dcNoArr[j][i] = str(lot%10) lot = int(lot/10) list2 = [2,6,10,14] for j in range(0,10000): k=j for i in list2: dcNoArr[j][i] = str(k%10) k=int(k/10) dcNoArr[j][15] = luhn(dcNoArr[j]) cardNo = ("".join(dcNoArr[j])) cvv = str(randint(100, 999)) pin = str(randint(1000, 9999)) print(cardNo,vfm, vfy,vtm, vty,lott,cvv,pin) modelInstace = DebitCard(debitCardNumber=cardNo, validFromMonth=vfm, validFromYear=vfy, validThruMonth=vtm, validThruYear=vty, lottNo=lott, cvv=cvv, pin=pin) modelInstace.save()
def nextLuhn(n): """nextLuhn(int) -> int Gets the smallest Luhn number greater than n. Uses a naive (exhaustive) algorithm that must try the Luhn checksum an average of 10 times. """ n+=1 while not luhn(n): n+=1 return n
def nextLuhn(n): """nextLuhn(int) -> int Gets the smallest Luhn number greater than n. Uses a naive (exhaustive) algorithm that must try the Luhn checksum an average of 10 times. """ n += 1 while not luhn(n): n += 1 return n
def biggerLuhn(n): """ biggerLuhn(int) -> int Gets a Luhn number greater than n. Uses a probability model that is very efficient if n passes the Luhn checksum. It may be possible to miss a Luhn number with this method. """ for t in [8, 18, 7, 17, 6, 16]: if luhn(n+t): return n+t return nextLuhn(n)
def biggerLuhn(n): """ biggerLuhn(int) -> int Gets a Luhn number greater than n. Uses a probability model that is very efficient if n passes the Luhn checksum. It may be possible to miss a Luhn number with this method. """ for t in [8, 18, 7, 17, 6, 16]: if luhn(n + t): return n + t return nextLuhn(n)