From 28d84acc28a922e3ef6b33e1deae00cf9d91cdcc Mon Sep 17 00:00:00 2001 From: pnu Date: Mon, 30 Oct 2023 17:38:05 +0100 Subject: [PATCH] chore: Do not check for dexdump presence on install --- exodus_core/analysis/static_analysis.py | 22 ++++++++++++++++++++++ setup.py | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/exodus_core/analysis/static_analysis.py b/exodus_core/analysis/static_analysis.py index 36bdaa9..7dc06a8 100644 --- a/exodus_core/analysis/static_analysis.py +++ b/exodus_core/analysis/static_analysis.py @@ -21,6 +21,23 @@ PHASH_SIZE = 8 +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + return None + + def get_td_url(): DEFAULT = "https://matlink.fr/token/email/gsfid" cred_paths_list = [ @@ -164,6 +181,11 @@ def _get_embedded_classes(apkfile, depth=0): classes = classes.union(StaticAnalysis._get_embedded_classes(apk_fp, depth + 1)) elif class_regex.search(info.filename): + if which('dexdump') is None: + logging.error("Unable to find dexdump executable, please install it.") + logging.error("On Debian-like OS, run sudo apt-get install dexdump") + sys.exit(1) + apk_zip.extract(info, tmp_dir) run = subprocess.check_output(['dexdump', f'{tmp_dir}/{info.filename}']) classes = classes.union(set(re.findall(r'[A-Z]+((?:\w+\/)+\w+)', run.decode(errors='ignore')))) diff --git a/setup.py b/setup.py index 0f5a5c3..1109c26 100644 --- a/setup.py +++ b/setup.py @@ -6,23 +6,6 @@ from setuptools import setup, find_packages -def which(program): - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - - fpath, fname = os.path.split(program) - if fpath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - return None - - if sys.version_info.major == 3 and sys.version_info.minor < 3: print("Unfortunately, your python version is not supported!\n Please upgrade at least to python 3.3!") sys.exit(1) @@ -31,11 +14,6 @@ def is_exe(fpath): print("Unfortunately, we do not support your platform %s" % sys.platform) sys.exit(1) -if which('dexdump') is None: - print("Unable to find dexdump executable, please install it.") - print("On Debian-like OS, run sudo apt-get install dexdump") - sys.exit(1) - install_requires = [ 'androguard==3.3.5', 'cryptography==3.3.2',