Skip to content

Commit

Permalink
chore: Do not require dexdump to install package (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnu-s authored Nov 22, 2023
1 parent 57c0329 commit 967e65f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
22 changes: 22 additions & 0 deletions exodus_core/analysis/static_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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'))))
Expand Down
23 changes: 0 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
#!/usr/bin/env python

import os
import sys

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)
Expand All @@ -31,11 +13,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',
Expand Down

0 comments on commit 967e65f

Please sign in to comment.