diff --git a/android_class_shadowing_scanner/__init__.py b/android_class_shadowing_scanner/__init__.py index b7c91e5..f4d02ec 100644 --- a/android_class_shadowing_scanner/__init__.py +++ b/android_class_shadowing_scanner/__init__.py @@ -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) diff --git a/android_class_shadowing_scanner/androzoo.py b/android_class_shadowing_scanner/androzoo.py index 08340cf..7b4e4e6 100644 --- a/android_class_shadowing_scanner/androzoo.py +++ b/android_class_shadowing_scanner/androzoo.py @@ -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