'ignore' errors
This commit is contained in:
parent
096e38ec12
commit
0d524d6a3e
1 changed files with 22 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import pprint
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from .androzoo import download_apk
|
from .androzoo import download_apk
|
||||||
from .data import ApkData, load_from_directory
|
from .data import ApkData, load_from_directory
|
||||||
|
|
@ -110,7 +111,16 @@ def main():
|
||||||
print(f"APK: {str(apk_path)}")
|
print(f"APK: {str(apk_path)}")
|
||||||
with apk_path.open("rb") as file:
|
with apk_path.open("rb") as file:
|
||||||
with zipfile.ZipFile(file) as apk:
|
with zipfile.ZipFile(file) as apk:
|
||||||
entry = analyze(apk, sha256, verbose=args.pprint)
|
try:
|
||||||
|
entry = analyze(apk, sha256, verbose=args.pprint)
|
||||||
|
except Exception as e:
|
||||||
|
log = f"[{datetime.today().strftime('%Y-%m-%d %H:%M:%S')}] Failed to analyzed {sha256}: {e}, abort"
|
||||||
|
if logfile:
|
||||||
|
with logfile.open("a") as file:
|
||||||
|
file.write(f"{log}\n")
|
||||||
|
else:
|
||||||
|
print(log)
|
||||||
|
continue
|
||||||
if args.pprint:
|
if args.pprint:
|
||||||
pprint.pprint(entry)
|
pprint.pprint(entry)
|
||||||
if not args.output_dir:
|
if not args.output_dir:
|
||||||
|
|
@ -162,7 +172,17 @@ def main():
|
||||||
if apk_bin is None:
|
if apk_bin is None:
|
||||||
continue
|
continue
|
||||||
with zipfile.ZipFile(io.BytesIO(apk_bin)) as apk:
|
with zipfile.ZipFile(io.BytesIO(apk_bin)) as apk:
|
||||||
entry = analyze(apk, sha256, verbose=args.pprint)
|
try:
|
||||||
|
entry = analyze(apk, sha256, verbose=args.pprint)
|
||||||
|
except Exception as e:
|
||||||
|
log = f"[{datetime.today().strftime('%Y-%m-%d %H:%M:%S')}] Failed to analyzed {sha256}: {e}, abort"
|
||||||
|
if logfile:
|
||||||
|
with logfile.open("a") as file:
|
||||||
|
file.write(f"{log}\n")
|
||||||
|
else:
|
||||||
|
print(log)
|
||||||
|
continue
|
||||||
|
|
||||||
if args.pprint:
|
if args.pprint:
|
||||||
pprint.pprint(entry)
|
pprint.pprint(entry)
|
||||||
if not args.output_dir:
|
if not args.output_dir:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue