Skip to content

Instantly share code, notes, and snippets.

@C0axx
Created August 21, 2023 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C0axx/75f1a5668d2d6caee415d87f85f82b02 to your computer and use it in GitHub Desktop.
Save C0axx/75f1a5668d2d6caee415d87f85f82b02 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
echo "[*] Creating temporary directory..."
TMPDIR="$(mktemp -d --suffix=_bloodhound-customqueries)"
# Compass BloodHound Customqueries
echo "[*] Downloading Compass BloodHound customqueries..."
curl -s -o "$TMPDIR/customqueries-compass.json" "https://raw.githubusercontent.com/CompassSecurity/BloodHoundQueries/master/BloodHound_Custom_Queries/customqueries.json"
echo "[*] Modifying category on Compass BloodHound customqueries..."
jq '.queries[].category |= (sub("^";"🧭 Compass: "))' < "$TMPDIR/customqueries-compass.json" > "$TMPDIR/customqueries-01-compass-modified.json"
# ZephrFish BloodHound Customqueries
echo "[*] Downloading ZephrFish BloodHound customqueries..."
curl -s -o "$TMPDIR/customqueries-compass.json" "https://raw.githubusercontent.com/ZephrFish/Bloodhound-CustomQueries/main/customqueries.json"
echo "[*] Modifying category on ZephrFish BloodHound customqueries..."
jq '.queries[].category |= (sub("^";"☠️ ZephrFish: "))' < "$TMPDIR/customqueries-compass.json" > "$TMPDIR/customqueries-01-zephrfish-modified.json"
# Certipy BloodHound Customqueries
echo "[*] Downloading Certipy BloodHound customqueries..."
curl -s -o "$TMPDIR/customqueries-certipy.json" "https://raw.githubusercontent.com/ly4k/Certipy/main/customqueries.json"
echo "[*] Modifying category on Certipy BloodHound customqueries..."
jq '.queries[].category |= (sub("^";"🔏 Certipy: "))' < "$TMPDIR/customqueries-certipy.json" > "$TMPDIR/customqueries-02-certipy-modified.json"
# Hausec BloodHound Customqueries
echo "[*] Downloading Hausec BloodHound customqueries..."
curl -s -o "$TMPDIR/customqueries-hausec.json" "https://raw.githubusercontent.com/hausec/Bloodhound-Custom-Queries/master/customqueries.json"
echo "[*] Adding category to Hausec BloodHound customqueries..."
jq '.queries[] |= { "category": "💻 Hausec" } +. ' < "$TMPDIR/customqueries-hausec.json" > "$TMPDIR/customqueries-02-hausec-modified.json"
echo "[*] Merging queries..."
cat "$TMPDIR/"*-modified.json | jq -s 'add + {queries: map(.queries[])}' > customqueries.json
echo "[*] Done. Please copy to your config directory:"
echo "cp customqueries.json ~/.config/bloodhound/"
echo "[*] Bye."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment