Files
NeuroSploit/env.sh
T
4eed1ce652 feat: proof screenshots in reports (finding-correlated) + source-able env.sh (#37)
* feat: embed proof screenshots in reports, correlated to findings

Define a convention that ties each proof image to its vulnerability and
renders it in every report format.

- Finding gains `screenshots: Vec<String>` (paths relative to the run
  workdir, e.g. evidence/<finding-id>-1.png).
- Exploit prompt injects an EVIDENCE SCREENSHOTS doctrine: agents save
  proof PNGs into the run's absolute evidence/ dir named by a vuln slug,
  and list them in the finding JSON `screenshots` array.
- collect_evidence() resolves whatever the agent captured (absolute,
  workdir-relative, evidence/, /tmp basename), copies it to a stable
  evidence/<finding-id>-N.png, and rewrites the field; unresolved refs
  are dropped so a report never embeds a missing image.
- Typst (image()), HTML (<img>) and Markdown (![]) render each finding's
  screenshots beside its evidence.

Tests: slugify + collect_evidence resolution/rename; verified a real PDF
compiles with an embedded image.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BGLy4j5qsqqid6CoovowC

* feat: source-able env.sh to activate neurosploit in the current shell

Add env.sh: `source` it to export NEUROSPLOIT (binary path),
NEUROSPLOIT_BASE (agents base) and prepend the binary dir to PATH —
no reinstall or new terminal needed. Auto-detects the install/repo dir,
honors NEUROSPLOIT_DIR, idempotent. setup.sh now writes a ready env.sh
into the install dir and points users at `source <dir>/env.sh`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BGLy4j5qsqqid6CoovowC

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-31 20:32:15 -03:00

53 lines
2.0 KiB
Bash
Executable File

# NeuroSploit environment — source this to use `neurosploit` in the CURRENT shell
# without reinstalling or opening a new terminal:
#
# source env.sh # from a repo checkout or an install dir
# source ~/.neurosploit-app/env.sh
#
# It exports:
# NEUROSPLOIT_BASE the app/agents base dir (agents_md lives here)
# NEUROSPLOIT full path to the neurosploit binary
# PATH prepended with the binary's dir so `neurosploit` resolves
#
# Honors NEUROSPLOIT_DIR to point at a custom install dir. Safe to source twice.
# Resolve where this script lives (works when sourced from bash or zsh).
if [ -n "${BASH_SOURCE:-}" ]; then _ns_self="${BASH_SOURCE[0]}"
elif [ -n "${ZSH_VERSION:-}" ]; then _ns_self="${(%):-%N}"
else _ns_self="$0"; fi
_ns_here="$(cd "$(dirname "$_ns_self")" >/dev/null 2>&1 && pwd)"
# Pick the base dir: explicit override → this script's dir → default install dir.
_ns_base="${NEUROSPLOIT_DIR:-$_ns_here}"
# Find the binary: alongside the base, in a repo release build, or on PATH.
_ns_bin=""
for _c in \
"$_ns_base/neurosploit" \
"$_ns_here/neurosploit" \
"$_ns_here/neurosploit-rs/target/release/neurosploit" \
"$_ns_here/target/release/neurosploit" \
"$HOME/.neurosploit-app/neurosploit"
do
if [ -x "$_c" ]; then _ns_bin="$_c"; break; fi
done
if [ -z "$_ns_bin" ] && command -v neurosploit >/dev/null 2>&1; then
_ns_bin="$(command -v neurosploit)"
fi
if [ -z "$_ns_bin" ]; then
echo "neurosploit binary not found — run setup.sh (or set NEUROSPLOIT_DIR) first." >&2
else
# agents_md sits next to the binary unless the base already has it.
if [ -d "$_ns_base/agents_md" ]; then :; else _ns_base="$(dirname "$_ns_bin")"; fi
export NEUROSPLOIT_BASE="$_ns_base"
export NEUROSPLOIT="$_ns_bin"
case ":$PATH:" in
*":$(dirname "$_ns_bin"):"*) : ;; # already on PATH
*) export PATH="$(dirname "$_ns_bin"):$PATH" ;;
esac
echo "NeuroSploit ready — NEUROSPLOIT=$NEUROSPLOIT · NEUROSPLOIT_BASE=$NEUROSPLOIT_BASE"
fi
unset _ns_self _ns_here _ns_base _ns_bin _c