Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wb4r/f33ee3b5044d4e8446ef4258ff26f0fb to your computer and use it in GitHub Desktop.
Save wb4r/f33ee3b5044d4e8446ef4258ff26f0fb to your computer and use it in GitHub Desktop.
github repos cloner + trufflehog & gittyleaks checker
#!/bin/bash
USERNAME=$1
# Only reads 200 for now. Havent implemented token + page iteration to extend this
# Show repo name when showing findings
# display help/usage
# display need of install pip install gittyleaks => pip list --format=legacy | grep -F gittyleaks
# AND trufflehog => pip install truffleHog
echo "Creating directory for $1"
mkdir $1
cd $1
echo ""
echo "Found these repos:"
curl -s https://api.github.com/users/$USERNAME/repos?per_page=200 | jq -r '.[].name'
echo ""
echo "Downloading repositories"
curl -s https://api.github.com/users/$USERNAME/repos?per_page=200 | jq -r '.[].clone_url' | xargs -n 1 git clone
echo ""
echo "Download doen"
echo ""
echo "gittyleaks => Checking repos for creds and keys"
for d in *; do
echo " Checking: $d"
gittyleaks -user=$1 -repo $d
echo ""
echo ""
done
echo ""
echo "truffleHog => Checking repos for creds and keys"
for d in *; do
echo " Checking: $d"
trufflehog --regex --entropy=False $d
echo ""
echo ""
done
echo ""
echo "Fin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment