Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion capabilities/network-ops/capability.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema: 1
name: network-ops
version: "2.1.1"
version: "2.1.2"
description: >
Network operations and Active Directory exploitation. Multi-agent
pipeline for autonomous red teaming with Nmap scanning, Netexec
Expand Down
2 changes: 1 addition & 1 deletion capabilities/network-ops/scripts/install_coercion_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -euo pipefail
# runtime Python can't import impacket, install it explicitly.
if ! python3 -c "import impacket" 2>/dev/null; then
echo "[+] Installing impacket into runtime Python"
python3 -m pip install --quiet "impacket>=0.12.0" 2>/dev/null \
python3 -m pip install --quiet "impacket>=0.12.0" \
|| python3 -m pip install --quiet --break-system-packages "impacket>=0.12.0"
else
echo "[*] impacket already importable, skipping"
Expand Down
45 changes: 45 additions & 0 deletions capabilities/network-ops/tools/impacket.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,51 @@ def _extract_real_path_from_wrapper(wrapper_path: Path) -> Path | None:
return None


def _ensure_impacket_installed() -> None:
"""Install impacket into the running Python if it's not importable.

The runtime may not process ``dependencies.python`` from
``capability.yaml``, so we do a best-effort pip install at import
Comment thread
mkultraWasHere marked this conversation as resolved.
time as a fallback.

Set ``DREADNODE_SKIP_AUTO_INSTALL=1`` to disable (useful in tests/CI).
"""
if os.environ.get("DREADNODE_SKIP_AUTO_INSTALL", "").strip() in ("1", "true", "yes"):
return
Comment thread
mkultraWasHere marked this conversation as resolved.

try:
import impacket as _ # noqa: F401
except ImportError:
import subprocess

logger.warning("impacket not importable — attempting pip install")
for extra_args in ([], ["--break-system-packages"]):
try:
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"--quiet",
"impacket>=0.12.0",
*extra_args,
],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=True,
timeout=120,
)
logger.info("impacket installed successfully")
return
except (subprocess.CalledProcessError, subprocess.TimeoutExpired, OSError):
continue
Comment thread
mkultraWasHere marked this conversation as resolved.
logger.error("Failed to install impacket — impacket tools will not work")


_ensure_impacket_installed()


Comment thread
mkultraWasHere marked this conversation as resolved.
def _get_impacket_script_path() -> Path:
"""
Auto-discover the impacket scripts directory.
Expand Down
Loading