Last active
March 10, 2021 07:32
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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