From 4c2440a468694824a92d16ecc7ed9bc34149e8b5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 12 Nov 2024 23:20:50 -0500 Subject: [PATCH 1/3] make java a shared dep --- .github/workflows/distro_tests.yml | 2 +- .github/workflows/tests.yml | 2 +- bbot/core/helpers/depsinstaller/installer.py | 1 + bbot/core/shared_deps.py | 33 ++++++++++++++++++++ bbot/modules/jadx.py | 25 +-------------- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index d54b7a667..95f9d7b5f 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,4 +61,4 @@ jobs: export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO -k gowitness . + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99c6574dd..507b7ac54 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot -k gowitness . + poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Debug Logs uses: actions/upload-artifact@v3 with: diff --git a/bbot/core/helpers/depsinstaller/installer.py b/bbot/core/helpers/depsinstaller/installer.py index 944de463b..652a10989 100644 --- a/bbot/core/helpers/depsinstaller/installer.py +++ b/bbot/core/helpers/depsinstaller/installer.py @@ -350,6 +350,7 @@ def install_core_deps(self): "make": "make", "gcc": "gcc", "bash": "bash", + "which": "which", } for command, package_name in core_deps.items(): if not self.parent_helper.which(command): diff --git a/bbot/core/shared_deps.py b/bbot/core/shared_deps.py index bac3ded7b..8be112982 100644 --- a/bbot/core/shared_deps.py +++ b/bbot/core/shared_deps.py @@ -159,6 +159,39 @@ }, ] +DEP_JAVA = [ + { + "name": "Check if Java is installed", + "command": "which java", + "register": "java_installed", + "ignore_errors": True, + }, + { + "name": "Install latest JRE (Debian)", + "package": {"name": ["default-jre"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'Debian' and java_installed.rc != 0", + }, + { + "name": "Install latest JRE (Arch)", + "package": {"name": ["jre-openjdk"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'Archlinux' and java_installed.rc != 0", + }, + { + "name": "Install latest JRE (Fedora)", + "package": {"name": ["which", "java-latest-openjdk-headless"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'RedHat' and java_installed.rc != 0", + }, + { + "name": "Install latest JRE (Alpine)", + "package": {"name": ["openjdk11"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'Alpine' and java_installed.rc != 0", + }, +] + # shared module dependencies -- ffuf, massdns, chromium, etc. SHARED_DEPS = {} for var, val in list(locals().items()): diff --git a/bbot/modules/jadx.py b/bbot/modules/jadx.py index 86a8ecf89..5db78bf9a 100644 --- a/bbot/modules/jadx.py +++ b/bbot/modules/jadx.py @@ -18,31 +18,8 @@ class jadx(BaseModule): options_desc = { "threads": "Maximum jadx threads for extracting apk's, default: 4", } + deps_shared = ["java"] deps_ansible = [ - { - "name": "Install latest JRE (Debian)", - "package": {"name": ["default-jre"], "state": "present"}, - "become": True, - "when": "ansible_facts['os_family'] == 'Debian'", - }, - { - "name": "Install latest JRE (Arch)", - "package": {"name": ["jre-openjdk"], "state": "present"}, - "become": True, - "when": "ansible_facts['os_family'] == 'Archlinux'", - }, - { - "name": "Install latest JRE (Fedora)", - "package": {"name": ["which", "java-latest-openjdk-headless"], "state": "present"}, - "become": True, - "when": "ansible_facts['os_family'] == 'RedHat'", - }, - { - "name": "Install latest JRE (Alpine)", - "package": {"name": ["openjdk11"], "state": "present"}, - "become": True, - "when": "ansible_facts['os_family'] == 'Alpine'", - }, { "name": "Create jadx directory", "file": {"path": "#{BBOT_TOOLS}/jadx", "state": "directory", "mode": "0755"}, From 0078a3ab072a48ece85f4b9e45c01088961ecdf6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 13 Nov 2024 00:03:07 -0500 Subject: [PATCH 2/3] jadx debugging --- bbot/modules/jadx.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bbot/modules/jadx.py b/bbot/modules/jadx.py index 5db78bf9a..25a9f1a3f 100644 --- a/bbot/modules/jadx.py +++ b/bbot/modules/jadx.py @@ -79,10 +79,9 @@ async def decompile_apk(self, path, output_dir): try: output = await self.run_process(command, check=True) except CalledProcessError as e: - self.warning(f"Error decompiling {path}. STDERR: {repr(e.stderr)}") + self.warning(f"Error decompiling {path}. STDOUT: {e.stdout} STDERR: {repr(e.stderr)}") return False - if not Path(output_dir / "resources").exists() and not Path(output_dir / "sources").exists(): - self.warning(f"JADX was unable to decompile {path}.") - self.warning(output) + if not (output_dir / "resources").exists() and not (output_dir / "sources").exists(): + self.warning(f"JADX was unable to decompile {path}: (STDOUT: {output.stdout} STDERR: {output.stderr})") return False return True From 9d8d7a17678a278d039a1dfa6d2b82b357193a68 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 13 Nov 2024 09:33:32 -0500 Subject: [PATCH 3/3] fix java dep --- bbot/modules/jadx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/modules/jadx.py b/bbot/modules/jadx.py index 25a9f1a3f..d065310ae 100644 --- a/bbot/modules/jadx.py +++ b/bbot/modules/jadx.py @@ -18,7 +18,7 @@ class jadx(BaseModule): options_desc = { "threads": "Maximum jadx threads for extracting apk's, default: 4", } - deps_shared = ["java"] + deps_common = ["java"] deps_ansible = [ { "name": "Create jadx directory",