Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

gitleaks + improved GH repos analysis

six2dez1c07defd6696
diff --git a/install.sh b/install.sh
index 91ef3f7..2a8b386 100755
--- a/install.sh
+++ b/install.sh
@@ -116,6 +116,7 @@ repos["regulator"]="cramppet/regulator"
repos["byp4xx"]="lobuhi/byp4xx"
repos["Infoga"]="m4ll0k/Infoga"
repos["ghauri"]="r0oth3x49/ghauri"
+repos["gitleaks"]="gitleaks/gitleaks"
function banner_web(){
@@ -157,35 +158,8 @@ install_webserver(){
printf "${yellow} Installing Requirements...${reset}\n\n"
$SUDO pip3 install -r $SCRIPTPATH/web/requirements.txt &>/dev/null
- #$SUDO virtualenv web/env &>/dev/null
- #$SUDO source web/env/bin/activate
- #$SUDO pip3 install -r web/requirements.txt &>/dev/null
-
printf "${yellow} Installing tools...${reset}\n\n"
$SUDO apt install redis-server -y &>/dev/null
- #$SUDO apt install postgresql -y &>/dev/null
-
- # printf "${yellow} Database configuration...${reset}\n\n"
- #$SUDO service postgresql restart &>/dev/null
- #$SUDO su postgres -c 'psql -c "DROP DATABASE web;"' &>/dev/null
- #$SUDO su postgres -c 'psql -c "CREATE DATABASE web;"' &>/dev/null
-
- #read -p ' What Username is used in db: ' DBUser
- #read -s -p ' What Password is used in db: ' DBPass
-
- #$SUDO su postgres 'psql -c "DROP USER "'$DBUser &> /dev/null
-
- #sed -i "s/'USER': '.*/'USER': '$DBUser',/" web/web/settings.py
- #sed -i "s/'PASSWORD': '.*/'PASSWORD': '$DBPass',/" web/web/settings.py
- #echo ""
-
- #printf "${yellow} Creating DB User...${reset}\n\n"
- #$SUDO su postgres -c "psql -c \"CREATE USER $DBUser with PASSWORD '$DBPass';\""
-
- #$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET client_encoding TO 'utf8';\""
- #$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET default_transaction_isolation TO 'read committed';\""
- #$SUDO su postgres -c "psql -c \"ALTER ROLE $DBUser SET timezone TO 'UTC';\""
- #$SUDO su postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE web TO $DBUser;\""
printf "${yellow} Creating WEB User...${reset}\n\n"
$SUDO rm $SCRIPTPATH/web/db.sqlite3 &>/dev/null
@@ -502,6 +476,9 @@ for repo in "${!repos[@]}"; do
if [ "massdns" = "$repo" ]; then
eval make $DEBUG_STD && strip -s bin/massdns && eval $SUDO cp bin/massdns /usr/local/bin/ $DEBUG_ERROR
fi
+ if [ "gitleaks" = "$repo" ]; then
+ eval make build $DEBUG_STD && eval $SUDO cp ./gitleaks /usr/local/bin/ $DEBUG_ERROR
+ fi
fi
if [ "gf" = "$repo" ]; then
eval cp -r examples ~/.gf $DEBUG_ERROR
diff --git a/reconftw.sh b/reconftw.sh
index 6936094..b9f4b9d 100755
--- a/reconftw.sh
+++ b/reconftw.sh
@@ -114,6 +114,7 @@ function tools_installed(){
which hakip2host &>/dev/null || { printf "${bred} [*] hakip2host [NO]${reset}\n${reset}"; allinstalled=false;}
which gau &>/dev/null || { printf "${bred} [*] gau [NO]${reset}\n${reset}"; allinstalled=false;}
which subgpt &>/dev/null || { printf "${bred} [*] subgpt [NO]${reset}\n${reset}"; allinstalled=false;}
+ which gitleaks &>/dev/null || { printf "${bred} [*] gitleaks [NO]${reset}\n${reset}"; allinstalled=false;}
if [ "${allinstalled}" = true ]; then
printf "${bgreen} Good! All installed! ${reset}\n\n"
@@ -175,9 +176,12 @@ function github_repos(){
GH_TOKEN=$(cat ${GITHUB_TOKENS} | head -1)
echo $domain | unfurl format %r > .tmp/company_name.txt
enumerepo -token-string ${GH_TOKEN} -usernames .tmp/company_name.txt -o .tmp/company_repos.txt 2>>"$LOGFILE" &>/dev/null
- [ -s .tmp/company_repos.txt ] && cat .tmp/company_repos.txt | jq -r '.[].repos[]|.url' > .tmp/company_repos_url.txt 2>>"$LOGFILE" &>/dev/null
- interlace -tL .tmp/company_repos_url.txt -threads ${INTERLACE_THREADS} -c "trufflehog git _target_ -j | jq -c > _output_/_cleantarget_" -o .tmp/github/ 2>>"$LOGFILE" &>/dev/null
- cat .tmp/github/* | jq -c | jq -r > osint/github_company_secrets.json 2>>"$LOGFILE" &>/dev/null
+ [ -s ".tmp/company_repos.txt" ] && cat .tmp/company_repos.txt | jq -r '.[].repos[]|.url' > .tmp/company_repos_url.txt 2>>"$LOGFILE" &>/dev/null
+ mkdir -p .tmp/github_repos 2>>"$LOGFILE" &>/dev/null
+ [ -s ".tmp/company_repos_url.txt" ] && interlace -tL .tmp/company_repos_url.txt -threads ${INTERLACE_THREADS} -c "git clone _target_ .tmp/github_repos/_cleantarget_" 2>>"$LOGFILE" &>/dev/null
+ [ -d ".tmp/github/" ] && ls .tmp/github_repos > .tmp/github_repos_folders.txt
+ [ -s ".tmp/company_repos_url.txt" ] && interlace -tL .tmp/github_repos_folders.txt -threads ${INTERLACE_THREADS} -c "gitleaks detect --source .tmp/github_repos/_target_ --no-banner --no-color -r ./tmp/github/gh_secret_cleantarget_.json" 2>>"$LOGFILE" &>/dev/null
+ [ -d ".tmp/github/" ] && cat .tmp/github/* | jq -c | jq -r > osint/github_company_secrets.json 2>>"$LOGFILE" &>/dev/null
else
printf "\n${bred} Required file ${GITHUB_TOKENS} not exists or empty${reset}\n"
fi