This commit is contained in:
Jean-Marie Mineau 2024-10-29 10:42:16 +01:00
parent 9027220508
commit 096e38ec12
2 changed files with 10 additions and 9 deletions

View file

@ -158,9 +158,10 @@ def main():
for sha256 in sha256s:
if args.output_dir and (args.output_dir / sha256).exists():
continue
with zipfile.ZipFile(
io.BytesIO(download_apk(sha256, api_key, logfile=logfile))
) as apk:
apk_bin = download_apk(sha256, api_key, logfile=logfile)
if apk_bin is None:
continue
with zipfile.ZipFile(io.BytesIO(apk_bin)) as apk:
entry = analyze(apk, sha256, verbose=args.pprint)
if args.pprint:
pprint.pprint(entry)

View file

@ -38,10 +38,10 @@ def download_apk(
else:
print(log)
time.sleep(delay)
log = f"[{datetime.today().strftime('%Y-%m-%d %H:%M:%S')}] Failed to download {sha256}, abort"
if logfile:
with logfile.open("a") as file:
file.write(f"{log}\n")
else:
print(log)
log = f"[{datetime.today().strftime('%Y-%m-%d %H:%M:%S')}] Failed to download {sha256}, abort"
if logfile:
with logfile.open("a") as file:
file.write(f"{log}\n")
else:
print(log)
return None