Skip to content

armgit / ARES

Public Imported from GitHub
0

ARES - authorized red-team engagement automation with dashboard, campaign scope, module orchestration, OPSEC controls, encrypted vault, and reporting.

fix(updater): resolve module IDs from multi-class files in update and upgrade filtering

Mafifrizi071749beb913
diff --git a/ares/cli/typer_main.py b/ares/cli/typer_main.py
index 9a9734a..f8affe7 100644
--- a/ares/cli/typer_main.py
+++ b/ares/cli/typer_main.py
@@ -2362,7 +2362,14 @@ def update_cmd(
new_mods = check_res.new_modules
if module:
cleaned = module.strip().lower()
- new_mods = [m for m in new_mods if m.module_id.lower() == cleaned or m.relative_path.lower().endswith(f"{cleaned}.py")]
+ local = mgr.get_local_modules()
+ target_rel_path = local[cleaned].relative_path.lower() if cleaned in local else None
+ new_mods = [
+ m for m in new_mods
+ if m.module_id.lower() == cleaned
+ or m.relative_path.lower().endswith(f"{cleaned}.py")
+ or (target_rel_path and m.relative_path.lower() == target_rel_path)
+ ]
if not new_mods:
console.print("[green][+] All official modules are already installed. No new modules available.[/green]")
diff --git a/ares/core/updater.py b/ares/core/updater.py
index 706a6ed..0b7c127 100644
--- a/ares/core/updater.py
+++ b/ares/core/updater.py
@@ -540,10 +540,16 @@ class PlatformUpdateManager:
if module_id:
cleaned_id = module_id.strip().lower()
- candidates = [m for m in candidates if m.module_id.lower() == cleaned_id or m.relative_path.lower().endswith(f"{cleaned_id}.py")]
+ local = self.get_local_modules()
+ target_rel_path = local[cleaned_id].relative_path.lower() if cleaned_id in local else None
+ candidates = [
+ m for m in candidates
+ if m.module_id.lower() == cleaned_id
+ or m.relative_path.lower().endswith(f"{cleaned_id}.py")
+ or (target_rel_path and m.relative_path.lower() == target_rel_path)
+ ]
if not candidates:
# Check if it is already installed
- local = self.get_local_modules()
if any(m.lower() == cleaned_id for m in local):
return {
"status": "already_installed",
@@ -599,7 +605,14 @@ class PlatformUpdateManager:
if module_id:
cleaned_id = module_id.strip().lower()
- candidates = [m for m in candidates if m.module_id.lower() == cleaned_id or m.relative_path.lower().endswith(f"{cleaned_id}.py")]
+ local = self.get_local_modules()
+ target_rel_path = local[cleaned_id].relative_path.lower() if cleaned_id in local else None
+ candidates = [
+ m for m in candidates
+ if m.module_id.lower() == cleaned_id
+ or m.relative_path.lower().endswith(f"{cleaned_id}.py")
+ or (target_rel_path and m.relative_path.lower() == target_rel_path)
+ ]
if not candidates:
return {
"status": "not_found",
diff --git a/tests/unit/test_property_based.py b/tests/unit/test_property_based.py
index 72921fa..9eef33f 100644
--- a/tests/unit/test_property_based.py
+++ b/tests/unit/test_property_based.py
@@ -193,7 +193,7 @@ class TestSanitizeHostname:
class TestSanitizePath:
@given(printable_text)
- @settings(max_examples=300, suppress_health_check=[HealthCheck.too_slow])
+ @settings(max_examples=300, suppress_health_check=[HealthCheck.too_slow], deadline=None)
def test_returns_string_or_rejects_unsafe_path(self, value: str) -> None:
try:
result = sanitize_path(value)
@@ -206,7 +206,7 @@ class TestSanitizePath:
assert isinstance(result, str)
@given(printable_text)
- @settings(max_examples=200)
+ @settings(max_examples=200, suppress_health_check=[HealthCheck.too_slow], deadline=None)
def test_idempotent(self, value: str) -> None:
try:
once = sanitize_path(value)