initial commit via gitinitshit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
*/secrets_*
|
||||||
|
*/parsed_*
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# fuck_git_downloader
|
||||||
|
downloads all of a github users public repos, scans them for secrets, then parses into something you can use.
|
||||||
|
|
||||||
|
this is barely even a script and yet its so hysterically effective that id be remiss not to post it. here be dragons and all idk
|
||||||
|
|
||||||
|

|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# packages required: git trufflehog gitsecrets pup
|
||||||
|
|
||||||
|
# todo: make dis an arg
|
||||||
|
github_username='nationalsecurityagency'
|
||||||
|
github_base='https://github.com/'
|
||||||
|
github_repos_page="$github_base/$github_username/"
|
||||||
|
|
||||||
|
# todo: make dis handle pagination
|
||||||
|
repos=$(curl -sS "${github_repos_page}?tab=repositories" | grep 'name codeRepository' | pup 'a attr{href}' | sed 's/\/PrincessPi3\///')
|
||||||
|
|
||||||
|
out_dir="$PWD/$github_username" #todo: make dis an arg
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
secretsfile="$PWD/secrets_${github_username}.txt"
|
||||||
|
|
||||||
|
nuke_repos_dir() {
|
||||||
|
if [ -d "$out_dir" ]; then
|
||||||
|
printf "deleting existing $out_dir... "
|
||||||
|
rm -rf "$out_dir" > /dev/null 2>&1
|
||||||
|
printf "$?\n"
|
||||||
|
|
||||||
|
printf "remaking $out_dir... "
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
printf "$?\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
clone_repos() {
|
||||||
|
for repo in "${repos[@]}"; do
|
||||||
|
printf "cloning $repo into $out_dir/$repo..."
|
||||||
|
|
||||||
|
git clone --recursive "$github_repos_page/$repo" "$out_dir/$repo" > /dev/null 2>&1
|
||||||
|
|
||||||
|
printf "$?\n"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
snoop_repos() {
|
||||||
|
for repo in "${repos[@]}"; do
|
||||||
|
cd "$out_dir/$repo"
|
||||||
|
pwd | tee -a "$secretsfile"
|
||||||
|
trufflehog git file://. | tee -a "$secretsfile"
|
||||||
|
gitleaks detect -v | tee -a "$secretsfile"
|
||||||
|
cd -
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# run em ig
|
||||||
|
nuke_repos_dir
|
||||||
|
clone_repos
|
||||||
|
snoop_repos
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 589 KiB |
Reference in New Issue
Block a user