Created
September 12, 2022 14:51
-
-
Save rw-r-r-0644/ac0a80c858130ac67210bf1306bc13ca to your computer and use it in GitHub Desktop.
Decode Amazon Fire TV devices serial number information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
# | |
# Decode Amazon Fire TV devices serial number information | |
# | |
# Copyright(C) 2022 rw-r-r-0644 | |
# This file is under GNU GPLv2+ | |
# | |
from datetime import datetime, date | |
from dataclasses import dataclass | |
@dataclass | |
class ModelDescription: | |
name: str | |
codename: str | |
release_year: int | |
ModelNoDescription = { | |
# TODO: other devices model numbers (these were extracted from videos or unboxings) | |
'G071CQ' : ModelDescription('Fire TV Stick Lite', 'sheldon', 2020), | |
'G071EL' : ModelDescription('Fire TV Stick', 'sheldonp', 2020), | |
'G061R2' : ModelDescription('Fire TV Stick 4K Max', 'kara', 2021), | |
} | |
def compute_production_year(model, year_dgt): | |
rel_dgt = model.release_year % 10 | |
diff_years = (year_dgt - rel_dgt) % 10 | |
if diff_years >= 8: | |
diff_years -= 10 | |
return model.release_year + diff_years | |
serial = input("Enter AFTV serial number: ").replace(" ", "") | |
modelno = serial[0:6] | |
modelinfo = ModelNoDescription[modelno] | |
unk0 = serial[6:8] | |
date_year = compute_production_year(modelinfo, int(serial[8])) | |
date_week = int(serial[9:11]) | |
date_day = int(serial[11]) % 7 | |
prod_date = datetime.strptime(f"{date_year} {date_week} {date_day}", "%Y %W %w") | |
serialno = serial[12:] | |
print(f"Model ID: {modelno}") | |
print("Production date: " + prod_date.strftime("%d/%m/%Y")) | |
print(f"Serial ID: {serialno}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment