-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPINGenerator.py
54 lines (46 loc) · 1.68 KB
/
PINGenerator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from checkCardPIN import generateCardPINFunc, parse_card_key
import json
# Generate a card PIN
# option = 0: only this UID is valid
# option = 1: the PIN for all UIDs are valid
# option = 2: the PIN for all UIDs are valid, you can add other usage scenarios
# if option = 0, the decoded UID will be a random 8-digit number
# if option = 1 or 2, the decoded UID will be the same as the input UID
priceLevel = 100
uid = "12345678"
option = 1
if option == 0:
optionContent = "only this UID is valid"
elif option == 1:
optionContent = "the PIN for all UIDs are valid"
elif option == 2:
optionContent = "the PIN for all UIDs are valid, you can add other usage scenarios"
def genMuti(a):
print("---------------------------")
print("the number of cardPIN: " + str(a))
cardPIN = []
for i in range(a):
# generate
cardPINtemp = generateCardPINFunc(priceLevel, uid, option)
cardPIN.append(cardPINtemp[1])
# print("copy this to the cardPIN.json: " + str(cardPINtemp[1]))
# check the generated cardPIN
parsed_uid, parsed_price = parse_card_key(cardPINtemp[1])
print("parsed uid:", parsed_uid, "price:", parsed_price)
print("-----------")
# opt0Str = "3408"
# opt1Str = "8196"
# opt2Str = "5072"
cardPIN = (
json.dumps(cardPIN)
.replace("[", "")
.replace("]", "")
.replace(",", ",\n")
.replace(" ", "")
)
print("---------------------------")
print("the price: " + str(priceLevel))
print("the cardPIN option:" + str(optionContent))
print("copy this to cardPIN.json: \n--------\n" + cardPIN)
# change this number to generate more cardPIN
genMuti(10)