Converted tclcheck_findprd.py
This commit is contained in:
parent
e048b992d4
commit
dd8be7be3b
@ -10,15 +10,13 @@ import sys
|
|||||||
|
|
||||||
from requests.exceptions import RequestException, Timeout
|
from requests.exceptions import RequestException, Timeout
|
||||||
|
|
||||||
import tcllib
|
|
||||||
import tcllib.argparser
|
import tcllib.argparser
|
||||||
from tcllib import ansi, devlist
|
from tcllib import ansi, devlist
|
||||||
from tcllib.devices import DesktopDevice, MobileDevice
|
from tcllib.devices import DesktopDevice
|
||||||
|
from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector, \
|
||||||
|
write_info_if_dumps_found
|
||||||
|
|
||||||
|
|
||||||
dev = DesktopDevice()
|
|
||||||
fc = tcllib.FotaCheck()
|
|
||||||
|
|
||||||
dpdesc = """
|
dpdesc = """
|
||||||
Finds new PRD numbers for all known variants, or specified variants with tocheck. Scan range
|
Finds new PRD numbers for all known variants, or specified variants with tocheck. Scan range
|
||||||
can be set by floor and ceiling switches.
|
can be set by floor and ceiling switches.
|
||||||
@ -58,6 +56,11 @@ if args.tocheck is not None:
|
|||||||
if not prddict:
|
if not prddict:
|
||||||
prddict[args.tocheck] = []
|
prddict[args.tocheck] = []
|
||||||
|
|
||||||
|
dev = DesktopDevice()
|
||||||
|
|
||||||
|
runner = RequestRunner(ServerVoteSelector(), https=False)
|
||||||
|
runner.max_tries = 20
|
||||||
|
|
||||||
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]]
|
||||||
safes = [g for g in range(floor, ceiling) if g not in tails]
|
safes = [g for g in range(floor, ceiling) if g not in tails]
|
||||||
@ -69,15 +72,13 @@ for center in sorted(prddict.keys()):
|
|||||||
done_count += 1
|
done_count += 1
|
||||||
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
||||||
print(ansi.UP_DEL, end="")
|
print(ansi.UP_DEL, end="")
|
||||||
try:
|
dev.curef = curef
|
||||||
dev.curef = curef
|
chk = CheckRequest(dev)
|
||||||
fc.reset_session(dev)
|
runner.run(chk)
|
||||||
check_xml = fc.do_check(dev, https=False, max_tries=20)
|
if chk.success:
|
||||||
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
chkres = chk.get_result()
|
||||||
txt_tv = tv
|
txt_tv = chkres.tvver
|
||||||
print("{}: {} {}".format(curef, txt_tv, fhash))
|
print("{}: {} {}".format(curef, txt_tv, chkres.filehash))
|
||||||
except (SystemExit, RequestException, Timeout) as e:
|
|
||||||
continue
|
|
||||||
|
|
||||||
print("Scan complete.")
|
print("Scan complete.")
|
||||||
tcllib.FotaCheck.write_info_if_dumps_found()
|
write_info_if_dumps_found()
|
||||||
|
Reference in New Issue
Block a user