#!/usr/bin/env bash # Formalize the three upstream sources under vendor/ as pinned git submodules. # # The build only needs the FILES under vendor/{gtfobins,lolbas,wadcoms}; they # are already present (moved in from the working clones, .git preserved), so # `npm run data` works right now without any of this. Run this only when you # want them tracked as proper, re-syncable submodules. # # NOTE: you (the maintainer) drive all VCS. This script is documentation you # can execute; it is never run by the site build or by CI. set -euo pipefail cd "$(dirname "$0")/.." pin() { # $1 = path, $2 = url local path="$1" url="$2" sha sha="$(git -C "$path" rev-parse HEAD)" # Adopt the existing checkout as a submodule at its current commit. git submodule add --force "$url" "$path" git -C "$path" checkout --quiet "$sha" echo " pinned $path @ ${sha:0:7}" } echo "Registering vendored upstreams as submodules…" pin vendor/gtfobins https://github.com/GTFOBins/GTFOBins.github.io.git pin vendor/lolbas https://github.com/LOLBAS-Project/LOLBAS.git pin vendor/wadcoms https://github.com/WADComs/WADComs.github.io.git git submodule absorbgitdirs || true cat <<'NOTE' Done. To refresh the dataset against the latest upstreams later: git submodule update --remote vendor/gtfobins vendor/lolbas vendor/wadcoms npm run data # regenerate src/data/techniques.json git add src/data/techniques.json && NOTE