Skip to content

Instantly share code, notes, and snippets.

@tanaka-geek
Last active March 10, 2021 07:32
Show Gist options
  • Save tanaka-geek/62db54752313e1d591e900629896535b to your computer and use it in GitHub Desktop.
Save tanaka-geek/62db54752313e1d591e900629896535b to your computer and use it in GitHub Desktop.
Auto Scrape the name of the git-repo and check if there's any leaks with gitleaks
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "[!]Argument is supposed to be the name of github user"
echo "Usage: ./getgits.sh username"
exit 1
fi
url="https://github.com/$1?tab=repositories"
repos=$(curl ${url} | grep 'codeRepository' | grep -Po 'href="(?:.*?(\"))' | grep -Po '(["])(?:(?=(\\?))\2.)*?\1' | tr -d '"')
echo $repos | sed -z 's/\s/\n/g' > "$1-repositories.txt"
sed -i -e 's/^/https:\/\/github.com/' "$1-repositories.txt"
touch "$1-gitleaks.json"
while read line; do gitleaks -v -r=$line >> "$1-gitleaks.json" ; done<"$1-repositories.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment