mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +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.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
|
||||
fc.curef = sys.argv[1]
|
||||
fc.fv = sys.argv[2]
|
||||
fc.curef = args.prd
|
||||
fc.fv = args.fvver
|
||||
fc.mode = fc.MODE_OTA
|
||||
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.mode = fc.MODE_FULL
|
||||
fc.cltp = 2010
|
||||
|
@ -15,11 +15,14 @@ fc.serid = "3531510"
|
||||
fc.mode = fc.MODE_OTA
|
||||
fc.cltp = 10
|
||||
|
||||
force_ver = False
|
||||
force_ver_text = ""
|
||||
if len(sys.argv) > 1:
|
||||
force_ver = sys.argv[1]
|
||||
force_ver_text = " from {}".format(force_ver)
|
||||
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 = ""
|
||||
|
||||
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:
|
||||
prdline = prdline.strip()
|
||||
prd, lastver, model = prdline.split(" ", 2)
|
||||
if force_ver != False:
|
||||
lastver = force_ver
|
||||
if args.forcever is not None:
|
||||
lastver = args.forcever
|
||||
try:
|
||||
fc.reset_session()
|
||||
fc.curef = prd
|
||||
|
@ -19,6 +19,18 @@ fc.mode = fc.MODE_FULL
|
||||
#fc.cltp = 10
|
||||
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:")
|
||||
|
||||
with open("prds.txt", "r") as afile:
|
||||
@ -30,21 +42,23 @@ with open("prds.txt", "r") as afile:
|
||||
for key, value in prdc.items():
|
||||
prddict[key].append(value)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
if args.tocheck is not None:
|
||||
prdkeys = list(prddict.keys())
|
||||
for k in prdkeys:
|
||||
if k != sys.argv[1]:
|
||||
if k != args.tocheck:
|
||||
del prddict[k]
|
||||
|
||||
if not prddict:
|
||||
prddict[args.tocheck] = []
|
||||
|
||||
for center in sorted(prddict.keys()):
|
||||
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
|
||||
print("Checking {} variant codes for model {}.".format(total_count, center))
|
||||
for j in range(0, 1000):
|
||||
if j in tails:
|
||||
continue
|
||||
for j in safes:
|
||||
curef = "PRD-{}-{:03}".format(center, j)
|
||||
done_count += 1
|
||||
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
||||
|
@ -13,18 +13,15 @@ fc = tcllib.FotaCheck()
|
||||
fc.serid = "3531510"
|
||||
fc.mode = fc.MODE_OTA
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Syntax: {} PRD [STARTVER] [ENDVER]".format(sys.argv[0]))
|
||||
sys.exit()
|
||||
dp = tcllib.DefaultParser(__file__)
|
||||
dp.add_argument("prd")
|
||||
dp.add_argument("startver", nargs="?", default="AAA000")
|
||||
dp.add_argument("endver", nargs="?", default="AAZ999")
|
||||
args = dp.parse_args(sys.argv[1:])
|
||||
|
||||
start_ver = "AAA000"
|
||||
end_ver = "AAZ999"
|
||||
if len(sys.argv) >= 2:
|
||||
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]
|
||||
fc.curef = args.prd
|
||||
start_ver = args.startver
|
||||
end_ver = args.endver
|
||||
|
||||
print("Valid firmwares for model {} (between {} and {}):".format(fc.curef, start_ver, end_ver))
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
# pylint: disable=C0111,C0326
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import binascii
|
||||
import hashlib
|
||||
@ -35,6 +36,11 @@ def make_escapes_work():
|
||||
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:
|
||||
VDKEY = b"eJwdjwEOwDAIAr8kKFr//7HhmqXp8AIIDrYAgg8byiUXrwRJRXja+d6iNxu0AhUooDCN9rd6rDLxmGIakUVWo3IGCTRWqCAt6X4jGEIUAxgN0eYWnp+LkpHQAg/PsO90ELsy0Npm/n2HbtPndFgGEV31R9OmT4O4nrddjc3Qt6nWscx7e+WRHq5UnOudtjw5skuV09pFhvmqnOEIs4ljPeel1wfLYUF4\n"
|
||||
CKTP_CHECKAUTO = 1
|
||||
|
Loading…
Reference in New Issue
Block a user