├── README.md └── where.sh /README.md: -------------------------------------------------------------------------------- 1 | # wheres-my-git 2 | Wheres My Git - Find /.git/config files based on dirs found in home url 3 | 4 | 5 | How to Run 6 | --- 7 | 8 | ``` 9 | ./where.sh targets.txt 10 | ``` 11 | 12 | A big thanks to jon williams from @bishopfox for making it nicer! 13 | 14 | Use a VPS from DO 15 | 16 | [![DigitalOcean Referral Badge](https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg)](https://www.digitalocean.com/?refcode=e22bbff5f6f1&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge) 17 | -------------------------------------------------------------------------------- /where.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Usage: ./where.sh targets.txt 4 | # 5 | # The target list should contain one target per line, beginning with http:// or https:// 6 | # It first scrapes the target sites for links to other pages, then checks all of those domains for git config files. 7 | 8 | check_target () { 9 | if $(curl -sk --connect-timeout 10 "$1.git/config" | grep -q "repositoryformatversion"); then 10 | echo "$1.git/config" 11 | fi 12 | } 13 | export -f check_target 14 | >/tmp/targets.tmp 15 | # Scrape targets to get more targets 16 | echo "Scraping targets..." 17 | cat $1 | parallel -j 25 --bar curl -skL --connect-timeout 10 | grep -Eo "(http|https)://[\da-z./?A-Z0-9\D=_-]*/" | sort -u >>/tmp/targets.tmp 18 | wait 19 | # Test for .git/config files and output to found.txt 20 | echo "Testing new targets..." 21 | cat /tmp/targets.tmp | parallel -j 25 --bar check_target | tee found.txt 22 | #rm /tmp/targets.tmp 23 | if [[ $(cat found.txt) == "" ]]; then 24 | echo "No results found." 25 | else 26 | echo "Done." 27 | fi 28 | --------------------------------------------------------------------------------