Added IMEI character length validation check in

imei_generate.py which ensures IMEI has 14-char
length, including validation digit
This commit is contained in:
nicholas 2023-10-13 13:05:40 +02:00
parent 09d2f8c087
commit 187378a1d6

View File

@ -141,6 +141,10 @@ def generate_imei(imei_prefix, imsi_d):
def validate_imei(imei): def validate_imei(imei):
# before anything check if length is 14 characters
if len(imei) != 14:
print(f"NOT A VALID IMEI: {imei} - IMEI must be 14 characters in length")
return False
# cut off last digit # cut off last digit
validation_digit = int(imei[-1]) validation_digit = int(imei[-1])
imei_verify = imei[0:14] imei_verify = imei[0:14]