Skip to content

Commit 1a50ddc

Browse files
authored
feat: Add TruffleHog secret scanning script to Cloud.md
Added a script for scanning GitHub organization repositories for secrets using TruffleHog.
1 parent bf02f33 commit 1a50ddc

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Cloud.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,3 +844,40 @@ for home in /home/* /root; do
844844
done
845845
done
846846
```
847+
848+
## GitHub TruffleHog Secret Scanning (T1552.001)
849+
850+
Down and dirty scanning for all repos in a GitHub org for verified secrets using TruffleHog. Clones over SSH, no PAT needed for repo access, just an SSH key with org permissions.
851+
852+
```bash
853+
#!/usr/bin/env bash
854+
set -euo pipefail
855+
856+
for cmd in gh git trufflehog; do
857+
if ! command -v "$cmd" &>/dev/null; then
858+
echo "Error: $cmd is not installed" >&2
859+
exit 1
860+
fi
861+
done
862+
863+
RESULTS_DIR="trufflehog-results"
864+
ORG="YOUR_ORG"
865+
mkdir -p "$RESULTS_DIR"
866+
867+
REPOS=()
868+
while IFS= read -r line; do
869+
REPOS+=("$line")
870+
done < <(gh repo list "$ORG" --limit 1000 --json name -q '.[].name')
871+
872+
for repo in "${REPOS[@]}"; do
873+
echo "Scanning $repo..."
874+
if git clone --quiet git@github.com:"$ORG"/"$repo".git; then
875+
trufflehog filesystem --only-verified "$repo" > "$RESULTS_DIR/$repo.txt" 2>&1
876+
rm -rf "$repo"
877+
else
878+
echo "Warning: failed to clone $repo, skipping" >&2
879+
fi
880+
done
881+
882+
echo "Results saved to $RESULTS_DIR/"
883+
```

0 commit comments

Comments
 (0)