#!/bin/bash
# packages required: git trufflehog gitsecrets

github='https://github.com/InfoSecREDD/'

out_dir="$PWD/redd_repos"
mkdir -p "$out_dir"

repos=("DWipe" "wifipineapplepager-payloads" "ThreatVis" "RadioRef-Export" "REDDs-PCAP-Uploader" "Uptime-Monitor" "Uni-Adblock" "PolyZip" "CVE-Discord-Notify" "shlt-plugins" "DarkGPT-Lite" "RPT-Installer" "YOURLS-Security-Audit-Plugin" "YOURLS-IP-Info" "InfoSecREDD.github.io" "sharkjack-payloads" "ExPW" "DeLookup" "CheckSim" "sb" "REPG-Community-Payloads" "BTSM-Payloads" "Flip-pi" "InvisInk-Encoder" "REPG" "NET-UP" "Adafruit_WebSerial_ESPTool" "BadPS" "omg-payloads" "k" "Flipper" "REDD-Demo" "SecF0EncKey" "SIN-Main" "sj-webui-patch" "MHS35-lcd-64bit-rpi" "verifymd5" "proxmark3" "DHunter" "termux-pm3-helper" "Proxmark3-Amiibo-Emulate" "Termux-Helper-Script" "NFC-Cloner" "Handshake-Transfer" "shark-files" "rtl8812au" "SharkLib" "rtl8812AU_8821AU_linux" "NET-UP-modules" "boot-dev" "RPi-Tweaks" "auto-ssh" "HoppEye" "bashbunny-payloads" "CPUMINER" "bash-no-ip-updater")

# 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
# 
# for repo in "${repos[@]}"; do
#     printf "cloning $repo into $out_dir/$repo..."
#     git clone --recursive "$github/$repo" "$out_dir/$repo" > /dev/null 2>&1
#     printf "$?\n"
# done

for repo in "${repos[@]}"; do
    cd "$out_dir/$repo"
    trufflehog git file://. --relative
    gitleaks detect -v
    cd -
done
