-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
25 lines (20 loc) · 801 Bytes
/
cli.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
from smartra import calculate_smartra_pin
def get_last_6_digits (text_input: str) -> int:
try:
return int(text_input[-6:])
except (ValueError, IndexError):
raise ValueError
def main():
print('[*] SMARTRA VIN to PIN calculator')
print('[*] This calculator should apply for all Hyundai and KIA models equipped with SMARTRA2')
print('[*] From 2007 or so, some models started using SMARTRA3 and a different algorithm - beware.')
while True:
try:
last_6_digits = get_last_6_digits(input('[*] Enter your VIN or just it\'s last 6 digits: '))
calculated_pin = calculate_smartra_pin(last_6_digits)
print('[*] All good! Your immo pin should be: {}'.format(calculated_pin))
break
except ValueError:
print('[!] Something went wrong. Try again')
if __name__ == '__main__':
main()