Files
NeuroSploit/setup.sh
T
CyberSecurityUP aae74e7597 feat: reactive probe integration, Havoc/Mythic C2 profiles, CVSS 4.0 scoring
- reactive_bridge.rs: wire DNS, TLS/SSL, cloud, GraphQL deterministic probes
  into reactive engine — probes run after recon, before LLM agents, loot feeds
  dual graph and agent prompt context via shell runner closure
- mcp_profiles.rs: Havoc C2 profile (15 tools: demons, listeners, shell, BOF,
  .NET assembly, token manipulation, SMB pivot, credential store) and Mythic C2
  profile (16 tools: callbacks, tasks, payloads, credentials, SOCKS, port
  forwarding, lateral movement, persistence, assembly, BOF, keylogger)
- reactive_bridge.rs: profile matching for havoc/mythic keywords
- setup.sh: optional install for Havoc C2 (NEUROSPLOIT_HAVOC_C2=1) and Mythic
  C2 (NEUROSPLOIT_MYTHIC_C2=1)
- cvss.rs: CVSS 4.0 support — Cvss4 struct, parse/score/severity, detect_version,
  parse_any unified parser, formula-based scoring with exploit maturity modifier,
  22 new tests (961 total passing)
2026-11-29 14:25:06 -03:00

310 lines
15 KiB
Bash
Executable File

#!/usr/bin/env bash
# NeuroSploit installer — by Joas A Santos & Red Team Leaders
#
# curl -fsSL https://raw.githubusercontent.com/JoasASantos/NeuroSploit/main/setup.sh | bash
#
# Downloads the prebuilt `neurosploit` binary + agent library, installs them, and
# sets up PATH + NEUROSPLOIT_BASE so you can run `neurosploit` from ANY folder —
# no need to cd into the repo. Falls back to building from source if no prebuilt
# asset fits (or NEUROSPLOIT_BUILD=1). Safe to re-run (idempotent). Honors:
# NEUROSPLOIT_DIR install dir (default: ~/.neurosploit-app)
# NEUROSPLOIT_REF release tag/branch (default: latest release)
# NEUROSPLOIT_BUILD 1 = build from source instead of downloading
# PREFIX bin symlink dir (default: ~/.local/bin)
set -euo pipefail
REPO_SLUG="JoasASantos/NeuroSploit"
REPO="https://github.com/${REPO_SLUG}.git"
DIR="${NEUROSPLOIT_DIR:-$HOME/.neurosploit-app}"
PREFIX="${PREFIX:-$HOME/.local/bin}"
c() { printf '\033[%sm%s\033[0m\n' "$1" "$2"; }
say(){ c '1;35' " ▌ $*"; }
ok() { c '1;32' " ✓ $*"; }
warn(){ c '1;33' " ! $*"; }
die(){ c '1;31' " ✗ $*"; exit 1; }
cat <<'BANNER'
███╗ ██╗███████╗██╗ ██╗██████╗ ██████╗
████╗ ██║██╔════╝██║ ██║██╔══██╗██╔═══██╗ NeuroSploit installer
██╔██╗ ██║█████╗ ██║ ██║██████╔╝██║ ██║ v4.4.2 — Rust harness
██║╚██╗██║██╔══╝ ██║ ██║██╔══██╗██║ ██║ by Joas A Santos
██║ ╚████║███████╗╚██████╔╝██║ ██║╚██████╔╝ & Red Team Leaders
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ v4.4.2
BANNER
# ---- platform detection (Linux / macOS / Windows-WSL · x64 / arm64) ----
OS_RAW="$(uname -s)"; ARCH_RAW="$(uname -m)"
case "$OS_RAW" in
Linux*) OS="linux" ;;
Darwin*) OS="macos" ;;
MINGW*|MSYS*|CYGWIN*) OS="windows" ;;
*) OS="$OS_RAW" ;;
esac
case "$ARCH_RAW" in
x86_64|amd64) ARCH="x64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) ARCH="$ARCH_RAW" ;;
esac
PLAT="${OS}-${ARCH}"
say "Platform: $PLAT"
[ "$OS" = "windows" ] && warn "Native Windows: prefer install.ps1 (PowerShell). This path works under WSL2/Git Bash."
dl() { # dl <url> <out>
if command -v curl >/dev/null 2>&1; then curl -fsSL "$1" -o "$2"
elif command -v wget >/dev/null 2>&1; then wget -qO "$2" "$1"
else return 1; fi
}
# ---- resolve the release tag (latest, unless pinned) ----
REF="${NEUROSPLOIT_REF:-}"
if [ -z "$REF" ]; then
REF="$(dl "https://api.github.com/repos/${REPO_SLUG}/releases/latest" /dev/stdout 2>/dev/null \
| grep -m1 '"tag_name"' | sed -E 's/.*"tag_name" *: *"([^"]+)".*/\1/' || true)"
fi
[ -z "$REF" ] && REF="v4.4.2"
say "Release: $REF"
installed=0
if [ "${NEUROSPLOIT_BUILD:-0}" != "1" ] && [ "$OS" != "windows" ]; then
# ---- try the prebuilt asset (no Rust needed) ----
ASSET="neurosploit-${REF}-${PLAT}.tar.gz"
URL="https://github.com/${REPO_SLUG}/releases/download/${REF}/${ASSET}"
TMP="$(mktemp -d)"
say "Downloading prebuilt binary: $ASSET"
if dl "$URL" "$TMP/a.tar.gz"; then
mkdir -p "$DIR"
tar -xzf "$TMP/a.tar.gz" -C "$TMP" 2>/dev/null || die "download was not a valid archive"
SRC="$(find "$TMP" -maxdepth 2 -name neurosploit -type f | head -1)"
[ -n "$SRC" ] || die "extracted archive has no neurosploit binary"
SRCDIR="$(dirname "$SRC")"
rm -rf "$DIR/neurosploit" "$DIR/agents_md"
cp "$SRCDIR/neurosploit" "$DIR/neurosploit"
cp -R "$SRCDIR/agents_md" "$DIR/agents_md"
chmod +x "$DIR/neurosploit"
rm -rf "$TMP"
installed=1
ok "Downloaded & unpacked → $DIR"
else
rm -rf "$TMP"
warn "No prebuilt asset for $PLAT ($REF) — building from source instead."
fi
fi
if [ "$installed" != "1" ]; then
# ---- build from source (needs git + Rust) ----
command -v git >/dev/null 2>&1 || die "git is required to build from source."
if ! command -v cargo >/dev/null 2>&1; then [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env" || true; fi
if ! command -v cargo >/dev/null 2>&1; then
say "Rust not found — installing rustup (stable, minimal)…"
curl --proto '=https' --tlsv1.2 -fsSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
. "$HOME/.cargo/env"
fi
ok "Rust: $(cargo --version)"
SRC_CO="$DIR/src"
if [ -d "$SRC_CO/.git" ]; then
say "Updating checkout…"; git -C "$SRC_CO" fetch --depth 1 origin "$REF" 2>/dev/null && git -C "$SRC_CO" checkout -q FETCH_HEAD 2>/dev/null || git -C "$SRC_CO" pull -q || true
else
say "Cloning $REPO ($REF)…"; git clone --depth 1 --branch "$REF" "$REPO" "$SRC_CO" 2>/dev/null || git clone --depth 1 "$REPO" "$SRC_CO"
fi
say "Building release binary (first build downloads crates)…"
( cd "$SRC_CO/neurosploit-rs" && cargo build --release )
cp "$SRC_CO/neurosploit-rs/target/release/neurosploit" "$DIR/neurosploit"
rm -rf "$DIR/agents_md"; cp -R "$SRC_CO/agents_md" "$DIR/agents_md"
chmod +x "$DIR/neurosploit"
ok "Built → $DIR"
fi
# ---- install on PATH ----
mkdir -p "$PREFIX"
ln -sf "$DIR/neurosploit" "$PREFIX/neurosploit"
ok "Linked → $PREFIX/neurosploit"
# ---- write a source-able env script (activate in the CURRENT shell) ----
cat > "$DIR/env.sh" <<EOF
# NeuroSploit env — \`source\` this to use neurosploit in the current shell.
export NEUROSPLOIT_BASE="$DIR"
export NEUROSPLOIT="$DIR/neurosploit"
case ":\$PATH:" in *":$PREFIX:"*) : ;; *) export PATH="$PREFIX:\$PATH" ;; esac
EOF
ok "Wrote env script → $DIR/env.sh (source it to activate now)"
ok "Version: $(NEUROSPLOIT_BASE="$DIR" "$DIR/neurosploit" --version 2>/dev/null || echo neurosploit)"
# ---- persist env (PATH + NEUROSPLOIT_BASE) so it runs from any folder ----
persist() { # append an idempotent block to a shell rc that exists
local rc="$1"; [ -e "$rc" ] || return 0
grep -q 'NEUROSPLOIT_BASE' "$rc" 2>/dev/null && return 0
{ echo ''; echo '# NeuroSploit (added by setup.sh)'
echo "export NEUROSPLOIT_BASE=\"$DIR\""
echo "export PATH=\"$PREFIX:\$PATH\""; } >> "$rc"
ok "Configured $rc"
}
SHELL_NAME="$(basename "${SHELL:-bash}")"
case "$SHELL_NAME" in
zsh) touch "$HOME/.zshrc"; persist "$HOME/.zshrc" ;;
bash) touch "$HOME/.bashrc"; persist "$HOME/.bashrc"; persist "$HOME/.bash_profile" ;;
*) touch "$HOME/.profile"; persist "$HOME/.profile" ;;
esac
if [ -d "$HOME/.config/fish" ]; then
FCONF="$HOME/.config/fish/config.fish"
if ! grep -q 'NEUROSPLOIT_BASE' "$FCONF" 2>/dev/null; then
{ echo ''; echo '# NeuroSploit'; echo "set -gx NEUROSPLOIT_BASE \"$DIR\""; echo "set -gx PATH \"$PREFIX\" \$PATH"; } >> "$FCONF"
ok "Configured $FCONF"
fi
fi
# ---- dependencies: detect, and install the ones a package manager can ----
# Core recon/report tools. Rust is already handled above. Auto-install is
# best-effort: it never fails the install, and is skipped with NEUROSPLOIT_NO_DEPS=1.
PKG=""; SUDO=""
if command -v apt-get >/dev/null 2>&1; then PKG="apt"
elif command -v brew >/dev/null 2>&1; then PKG="brew"
elif command -v dnf >/dev/null 2>&1; then PKG="dnf"
elif command -v pacman >/dev/null 2>&1; then PKG="pacman"
elif command -v apk >/dev/null 2>&1; then PKG="apk"; fi
[ "$(id -u)" = "0" ] || command -v sudo >/dev/null 2>&1 && [ "$(id -u)" != "0" ] && SUDO="sudo"
pkg_install() { # pkg_install <name...> — best-effort: never aborts the installer (set -e)
[ -n "$PKG" ] || { warn "no supported package manager — install manually: $*"; return 0; }
local log; log="$(mktemp 2>/dev/null || echo /tmp/neurosploit-pkg.log)"
local rc=0
case "$PKG" in
apt) { $SUDO apt-get update -qq && DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y "$@"; } >"$log" 2>&1 || rc=$? ;;
brew) brew install "$@" >"$log" 2>&1 || rc=$? ;;
dnf) $SUDO dnf install -y "$@" >"$log" 2>&1 || rc=$? ;;
pacman) $SUDO pacman -Sy --noconfirm "$@" >"$log" 2>&1 || rc=$? ;;
apk) $SUDO apk add "$@" >"$log" 2>&1 || rc=$? ;;
esac
if [ "$rc" != "0" ]; then
warn "$PKG failed installing: $* (exit $rc) — last lines:"
tail -n 5 "$log" 2>/dev/null | sed 's/^/ /'
fi
rm -f "$log"
return 0
}
# Map a required command to its package name on the detected manager.
pkg_name() { # pkg_name <cmd>
case "$1" in
npx) echo "node" ;; # npx ships with node
node) [ "$PKG" = "apt" ] && echo "nodejs" || echo "node" ;;
*) echo "$1" ;;
esac
}
if [ "${NEUROSPLOIT_NO_DEPS:-0}" != "1" ]; then
say "Checking dependencies (install with the detected package manager: ${PKG:-none})…"
# Essential for the web console + recon; typst is for PDF reports (optional).
for t in curl git nmap node; do
if command -v "$t" >/dev/null 2>&1; then ok "$t present"; else
warn "$t missing — installing…"; pkg_install "$(pkg_name "$t")"
command -v "$t" >/dev/null 2>&1 && ok "$t installed" || warn "could not install $t automatically — install it manually"
fi
done
# Rust-cargo extras + report engine: install via cargo when present (no root).
if command -v cargo >/dev/null 2>&1; then
command -v rustscan >/dev/null 2>&1 || { say "installing rustscan (cargo)…"; cargo install rustscan >/dev/null 2>&1 && ok "rustscan installed" || warn "rustscan optional — skipped"; }
command -v typst >/dev/null 2>&1 || { say "installing typst (cargo)…"; cargo install typst-cli >/dev/null 2>&1 && ok "typst installed" || warn "typst optional (PDF reports) — skipped"; }
fi
# ffuf is Go; only hint it.
command -v ffuf >/dev/null 2>&1 && ok "ffuf present" || warn "ffuf optional (fuzzing) — install via your package manager or Go"
# Sliver C2 MCP server (optional — for C2 operations via MCP).
SLIVER_MCP_DIR="${NEUROSPLOIT_SLIVER_MCP_PATH:-$DIR/sec-sliver-c2-mcp}"
if [ -d "$SLIVER_MCP_DIR/dist" ]; then
ok "Sliver C2 MCP present ($SLIVER_MCP_DIR)"
elif [ "${NEUROSPLOIT_SLIVER_C2:-0}" = "1" ]; then
say "Installing Sliver C2 MCP server…"
if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then
git clone --depth 1 https://github.com/schwarztim/sec-sliver-c2-mcp.git "$SLIVER_MCP_DIR" 2>/dev/null && \
( cd "$SLIVER_MCP_DIR" && npm install --production 2>/dev/null && npm run build 2>/dev/null ) && \
ok "Sliver C2 MCP installed ($SLIVER_MCP_DIR)" || \
warn "Sliver C2 MCP install failed — install manually: git clone + npm install + npm run build"
command -v python3 >/dev/null 2>&1 && { pip3 install sliver-py 2>/dev/null && ok "sliver-py installed" || warn "sliver-py install failed — pip3 install sliver-py"; }
else
warn "Sliver C2 MCP requires Node.js + npm — skipped"
fi
else
warn "Sliver C2 MCP not installed — set NEUROSPLOIT_SLIVER_C2=1 to install"
fi
# AdaptixC2 MCP server (optional — for AdaptixC2 operations via MCP).
ADAPTIX_MCP_DIR="${NEUROSPLOIT_ADAPTIX_MCP_PATH:-$DIR/AdaptixC2_mcp}"
if [ -f "$ADAPTIX_MCP_DIR/AdaptixC2_mcp.py" ]; then
ok "AdaptixC2 MCP present ($ADAPTIX_MCP_DIR)"
elif [ "${NEUROSPLOIT_ADAPTIX_C2:-0}" = "1" ]; then
say "Installing AdaptixC2 MCP server…"
if command -v uv >/dev/null 2>&1 || command -v pip3 >/dev/null 2>&1; then
git clone --depth 1 https://github.com/0xb11a1/AdaptixC2_mcp.git "$ADAPTIX_MCP_DIR" 2>/dev/null && \
( cd "$ADAPTIX_MCP_DIR" && { command -v uv >/dev/null 2>&1 && uv venv && uv pip install -r requirments.txt || pip3 install -r requirments.txt; } 2>/dev/null ) && \
ok "AdaptixC2 MCP installed ($ADAPTIX_MCP_DIR)" || \
warn "AdaptixC2 MCP install failed — install manually: git clone + uv pip install -r requirments.txt"
else
warn "AdaptixC2 MCP requires uv or pip3 — skipped"
fi
else
warn "AdaptixC2 MCP not installed — set NEUROSPLOIT_ADAPTIX_C2=1 to install"
fi
# Havoc C2 MCP server (optional — for Havoc C2 operations via MCP).
HAVOC_MCP_DIR="${NEUROSPLOIT_HAVOC_MCP_PATH:-$DIR/havoc-c2-mcp}"
if [ -f "$HAVOC_MCP_DIR/havoc_mcp.py" ]; then
ok "Havoc C2 MCP present ($HAVOC_MCP_DIR)"
elif [ "${NEUROSPLOIT_HAVOC_C2:-0}" = "1" ]; then
say "Installing Havoc C2 MCP server…"
if command -v python3 >/dev/null 2>&1; then
mkdir -p "$HAVOC_MCP_DIR" && \
ok "Havoc C2 MCP directory created ($HAVOC_MCP_DIR) — add havoc_mcp.py server implementation" || \
warn "Havoc C2 MCP setup failed — create $HAVOC_MCP_DIR manually"
else
warn "Havoc C2 MCP requires python3 — skipped"
fi
else
warn "Havoc C2 MCP not installed — set NEUROSPLOIT_HAVOC_C2=1 to install"
fi
# Mythic C2 MCP server (optional — for Mythic C2 operations via MCP).
MYTHIC_MCP_DIR="${NEUROSPLOIT_MYTHIC_MCP_PATH:-$DIR/mythic-c2-mcp}"
if [ -f "$MYTHIC_MCP_DIR/mythic_mcp.py" ]; then
ok "Mythic C2 MCP present ($MYTHIC_MCP_DIR)"
elif [ "${NEUROSPLOIT_MYTHIC_C2:-0}" = "1" ]; then
say "Installing Mythic C2 MCP server…"
if command -v python3 >/dev/null 2>&1; then
mkdir -p "$MYTHIC_MCP_DIR" && \
pip3 install mythic 2>/dev/null && \
ok "Mythic C2 MCP directory created ($MYTHIC_MCP_DIR) — add mythic_mcp.py server implementation" || \
warn "Mythic C2 MCP setup failed — create $MYTHIC_MCP_DIR and pip3 install mythic manually"
else
warn "Mythic C2 MCP requires python3 — skipped"
fi
else
warn "Mythic C2 MCP not installed — set NEUROSPLOIT_MYTHIC_C2=1 to install"
fi
else
say "Dependency auto-install skipped (NEUROSPLOIT_NO_DEPS=1)."
for t in curl git nmap node rustscan ffuf typst; do
command -v "$t" >/dev/null 2>&1 && ok "$t present" || warn "$t missing"
done
fi
echo
ok "Installed. Open a NEW terminal — or activate now with:"
echo " source \"$DIR/env.sh\""
echo " (equivalently: export NEUROSPLOIT_BASE=\"$DIR\"; export PATH=\"$PREFIX:\$PATH\")"
echo " then, from ANY folder:"
echo " neurosploit # interactive session"
echo " neurosploit run http://testphp.vulnweb.com/ --subscription --model anthropic:claude-opus-4-8 -v"
echo " neurosploit --help"
echo
warn "Update later: just re-run this script. Best runtime: Kali (docker run -it kalilinux/kali-rolling)."
# ---- optionally launch right away ----
# `curl | bash` has no TTY, so auto-run only when asked (NEUROSPLOIT_RUN=1) or
# when a real terminal is attached and the operator confirms.
RUN_NOW="${NEUROSPLOIT_RUN:-}"
if [ -z "$RUN_NOW" ] && [ -t 0 ]; then
printf '\n Launch the interactive session now? [y/N] '; read -r ans
case "$ans" in y|Y|yes) RUN_NOW=1 ;; esac
fi
if [ "$RUN_NOW" = "1" ]; then
say "Starting NeuroSploit…"
exec env NEUROSPLOIT_BASE="$DIR" "$DIR/neurosploit"
fi