-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·73 lines (64 loc) · 2.75 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·73 lines (64 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# Install bugbounty-ctf as an importable Python package AND a Hermes skill.
#
# Usage:
# ./install.sh # editable pip install + symlink the skill (stays in sync)
# ./install.sh --copy # copy files instead (+ post-commit re-sync hook, drift-proof)
# HERMES_SKILL_DIR=/path ./install.sh # override the skill location
#
# A bare `git clone` only gives Hermes the SKILL.md / references methodology;
# `from bugbounty_ctf import ...` needs the package installed, which this does.
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="${HERMES_SKILL_DIR:-$HOME/.hermes/skills/red-teaming/bugbounty-ctf}"
MODE="symlink"
AUTOSYNC=0
for arg in "$@"; do
case "$arg" in
--copy) MODE="copy" ;;
--autosync) AUTOSYNC=1 ;;
esac
done
echo "[*] repo: $REPO_DIR"
echo "[*] skill: $SKILL_DIR ($MODE mode)"
echo "[*] Installing Python package (editable; bundled wordlists ship as package data)..."
pip install -e "$REPO_DIR"
mkdir -p "$(dirname "$SKILL_DIR")"
if [ "$MODE" = "symlink" ]; then
if [ -L "$SKILL_DIR" ]; then
rm "$SKILL_DIR"
elif [ -e "$SKILL_DIR" ]; then
echo "[!] $SKILL_DIR exists and is not a symlink."
echo " Remove/back it up, or run with --copy. (HERMES_SKILL_DIR overrides the path.)"
exit 1
fi
ln -s "$REPO_DIR" "$SKILL_DIR"
echo "[+] Symlinked — the installed skill stays in sync with the repo automatically."
else
bash "$REPO_DIR/scripts/sync-skill.sh" "$SKILL_DIR"
# Drift protection: re-sync the copy after every commit.
hook="$REPO_DIR/.git/hooks/post-commit"
if [ -d "$REPO_DIR/.git" ]; then
{
echo "#!/usr/bin/env bash"
echo "exec bash \"$REPO_DIR/scripts/sync-skill.sh\" \"$SKILL_DIR\""
} >"$hook"
chmod +x "$hook"
echo "[+] Copied + installed a post-commit re-sync hook (keeps the copy drift-free)."
fi
fi
if [ "$AUTOSYNC" = "1" ]; then
echo "[*] Registering on_session_start autosync hook (pull latest from GitHub on start)..."
python3 "$REPO_DIR/scripts/register_autosync_hook.py"
echo " Note: Hermes asks for one-time consent the first time the hook fires."
fi
python -c "from bugbounty_ctf import SecurityScanner; print('[+] import OK')"
# kalibox drives a Kali container that is pulled/provisioned at runtime — it is
# not installed here. Surface the runtime prerequisite so it is not a surprise.
if command -v docker >/dev/null 2>&1; then
echo "[+] docker found — 'kalibox up' will pull kalilinux/kali-rolling (~1 GB) on first run."
else
echo "[!] docker not found on PATH. The Python toolkit works without it, but the"
echo " kalibox container ('kalibox up', privileged Kali) needs a container runtime."
fi
echo "[+] Done."