mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-10 06:16:46 +00:00
Merge branch 'master' of github.com:mbirth/tcl_ota_check
This commit is contained in:
commit
c236078aad
11
tclcheck.py
11
tclcheck.py
@ -12,12 +12,17 @@ fc.cltp = 10
|
|||||||
fc.serid = "3531510"
|
fc.serid = "3531510"
|
||||||
#fc.osvs = "7.1.1"
|
#fc.osvs = "7.1.1"
|
||||||
|
|
||||||
|
dp = tcllib.DefaultParser(__file__)
|
||||||
|
dp.add_argument("prd", nargs="?", default="AAM481")
|
||||||
|
dp.add_argument("fvver", nargs="?", default="PRD-63117-011")
|
||||||
|
args = dp.parse_args(sys.argv[1:])
|
||||||
|
|
||||||
if len(sys.argv) == 3: # python tclcheck.py $PRD $FV = OTA delta for $PRD from $FV
|
if len(sys.argv) == 3: # python tclcheck.py $PRD $FV = OTA delta for $PRD from $FV
|
||||||
fc.curef = sys.argv[1]
|
fc.curef = args.prd
|
||||||
fc.fv = sys.argv[2]
|
fc.fv = args.fvver
|
||||||
fc.mode = fc.MODE_OTA
|
fc.mode = fc.MODE_OTA
|
||||||
elif len(sys.argv) == 2: # python tclcheck.py $PRD = FULL for $PRD
|
elif len(sys.argv) == 2: # python tclcheck.py $PRD = FULL for $PRD
|
||||||
fc.curef = sys.argv[1]
|
fc.curef = args.prd
|
||||||
fc.fv = "AAA000"
|
fc.fv = "AAA000"
|
||||||
fc.mode = fc.MODE_FULL
|
fc.mode = fc.MODE_FULL
|
||||||
fc.cltp = 2010
|
fc.cltp = 2010
|
||||||
|
@ -15,11 +15,14 @@ fc.serid = "3531510"
|
|||||||
fc.mode = fc.MODE_OTA
|
fc.mode = fc.MODE_OTA
|
||||||
fc.cltp = 10
|
fc.cltp = 10
|
||||||
|
|
||||||
force_ver = False
|
dp = tcllib.DefaultParser(__file__)
|
||||||
|
dp.add_argument("forcever", nargs="?", default=None)
|
||||||
|
args = dp.parse_args(sys.argv[1:])
|
||||||
|
|
||||||
|
if args.forcever is not None:
|
||||||
|
force_ver_text = " from {}".format(args.forcever)
|
||||||
|
else:
|
||||||
force_ver_text = ""
|
force_ver_text = ""
|
||||||
if len(sys.argv) > 1:
|
|
||||||
force_ver = sys.argv[1]
|
|
||||||
force_ver_text = " from {}".format(force_ver)
|
|
||||||
|
|
||||||
print("List of latest OTA firmware{} by PRD:".format(force_ver_text))
|
print("List of latest OTA firmware{} by PRD:".format(force_ver_text))
|
||||||
|
|
||||||
@ -27,8 +30,8 @@ with open("prds.txt", "r") as f:
|
|||||||
for prdline in f:
|
for prdline in f:
|
||||||
prdline = prdline.strip()
|
prdline = prdline.strip()
|
||||||
prd, lastver, model = prdline.split(" ", 2)
|
prd, lastver, model = prdline.split(" ", 2)
|
||||||
if force_ver != False:
|
if args.forcever is not None:
|
||||||
lastver = force_ver
|
lastver = args.forcever
|
||||||
try:
|
try:
|
||||||
fc.reset_session()
|
fc.reset_session()
|
||||||
fc.curef = prd
|
fc.curef = prd
|
||||||
|
@ -19,6 +19,18 @@ fc.mode = fc.MODE_FULL
|
|||||||
#fc.cltp = 10
|
#fc.cltp = 10
|
||||||
fc.cltp = 2010
|
fc.cltp = 2010
|
||||||
|
|
||||||
|
dp = tcllib.DefaultParser(__file__)
|
||||||
|
dp.add_argument("tocheck", nargs="?", default=None)
|
||||||
|
dp.add_argument("-f", "--floor", dest="floor", nargs="?", type=int, default=0)
|
||||||
|
dp.add_argument("-c", "--ceiling", dest="ceiling", nargs="?", type=int, default=999)
|
||||||
|
args = dp.parse_args(sys.argv[1:])
|
||||||
|
|
||||||
|
floor = args.floor
|
||||||
|
ceiling = args.ceiling + 1
|
||||||
|
if ceiling < floor:
|
||||||
|
print("Invalid range!")
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
print("Valid PRDs not already in database:")
|
print("Valid PRDs not already in database:")
|
||||||
|
|
||||||
with open("prds.txt", "r") as afile:
|
with open("prds.txt", "r") as afile:
|
||||||
@ -30,21 +42,23 @@ with open("prds.txt", "r") as afile:
|
|||||||
for key, value in prdc.items():
|
for key, value in prdc.items():
|
||||||
prddict[key].append(value)
|
prddict[key].append(value)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if args.tocheck is not None:
|
||||||
prdkeys = list(prddict.keys())
|
prdkeys = list(prddict.keys())
|
||||||
for k in prdkeys:
|
for k in prdkeys:
|
||||||
if k != sys.argv[1]:
|
if k != args.tocheck:
|
||||||
del prddict[k]
|
del prddict[k]
|
||||||
|
if not prddict:
|
||||||
|
prddict[args.tocheck] = []
|
||||||
|
|
||||||
for center in sorted(prddict.keys()):
|
for center in sorted(prddict.keys()):
|
||||||
tails = [int(i) for i in prddict[center]]
|
tails = [int(i) for i in prddict[center]]
|
||||||
total_count = 1000 - len(tails)
|
safes = [g for g in range(floor, ceiling) if g not in tails]
|
||||||
|
if floor in tails:
|
||||||
|
floor = safes[0]
|
||||||
|
total_count = len(safes)
|
||||||
done_count = 0
|
done_count = 0
|
||||||
print("Checking {} variant codes for model {}.".format(total_count, center))
|
print("Checking {} variant codes for model {}.".format(total_count, center))
|
||||||
for j in range(0, 1000):
|
for j in safes:
|
||||||
if j in tails:
|
|
||||||
continue
|
|
||||||
curef = "PRD-{}-{:03}".format(center, j)
|
curef = "PRD-{}-{:03}".format(center, j)
|
||||||
done_count += 1
|
done_count += 1
|
||||||
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
||||||
|
@ -13,18 +13,15 @@ fc = tcllib.FotaCheck()
|
|||||||
fc.serid = "3531510"
|
fc.serid = "3531510"
|
||||||
fc.mode = fc.MODE_OTA
|
fc.mode = fc.MODE_OTA
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
dp = tcllib.DefaultParser(__file__)
|
||||||
print("Syntax: {} PRD [STARTVER] [ENDVER]".format(sys.argv[0]))
|
dp.add_argument("prd")
|
||||||
sys.exit()
|
dp.add_argument("startver", nargs="?", default="AAA000")
|
||||||
|
dp.add_argument("endver", nargs="?", default="AAZ999")
|
||||||
|
args = dp.parse_args(sys.argv[1:])
|
||||||
|
|
||||||
start_ver = "AAA000"
|
fc.curef = args.prd
|
||||||
end_ver = "AAZ999"
|
start_ver = args.startver
|
||||||
if len(sys.argv) >= 2:
|
end_ver = args.endver
|
||||||
fc.curef = sys.argv[1]
|
|
||||||
if len(sys.argv) >= 3:
|
|
||||||
start_ver = sys.argv[2]
|
|
||||||
if len(sys.argv) >= 4:
|
|
||||||
end_ver = sys.argv[3]
|
|
||||||
|
|
||||||
print("Valid firmwares for model {} (between {} and {}):".format(fc.curef, start_ver, end_ver))
|
print("Valid firmwares for model {} (between {} and {}):".format(fc.curef, start_ver, end_ver))
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# pylint: disable=C0111,C0326
|
# pylint: disable=C0111,C0326
|
||||||
|
|
||||||
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -35,6 +36,11 @@ def make_escapes_work():
|
|||||||
colorama.init()
|
colorama.init()
|
||||||
|
|
||||||
|
|
||||||
|
class DefaultParser(argparse.ArgumentParser):
|
||||||
|
def __init__(self, appname):
|
||||||
|
super().__init__(prog=appname.replace(".py", ""), epilog="https://github.com/mbirth/tcl_ota_check")
|
||||||
|
|
||||||
|
|
||||||
class FotaCheck:
|
class FotaCheck:
|
||||||
VDKEY = b"eJwdjwEOwDAIAr8kKFr//7HhmqXp8AIIDrYAgg8byiUXrwRJRXja+d6iNxu0AhUooDCN9rd6rDLxmGIakUVWo3IGCTRWqCAt6X4jGEIUAxgN0eYWnp+LkpHQAg/PsO90ELsy0Npm/n2HbtPndFgGEV31R9OmT4O4nrddjc3Qt6nWscx7e+WRHq5UnOudtjw5skuV09pFhvmqnOEIs4ljPeel1wfLYUF4\n"
|
VDKEY = b"eJwdjwEOwDAIAr8kKFr//7HhmqXp8AIIDrYAgg8byiUXrwRJRXja+d6iNxu0AhUooDCN9rd6rDLxmGIakUVWo3IGCTRWqCAt6X4jGEIUAxgN0eYWnp+LkpHQAg/PsO90ELsy0Npm/n2HbtPndFgGEV31R9OmT4O4nrddjc3Qt6nWscx7e+WRHq5UnOudtjw5skuV09pFhvmqnOEIs4ljPeel1wfLYUF4\n"
|
||||||
CKTP_CHECKAUTO = 1
|
CKTP_CHECKAUTO = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user