Subdomain enum

From woohyun212/security-skill · View interactive version

Subdomain enum is an AI agent skill from the GitHub repository woohyun212/security-skill. Subdomain enumeration using subfinder and amass to discover attack surface

How to use this skill

Skill file

What this skill does

Enumerates subdomains of a target domain using subfinder and amass. Collects results from multiple sources (Certificate Transparency, DNS brute-force, passive databases, etc.), merges and deduplicates them, then validates live hosts using httpx.

When to use

Prerequisites

```bash

go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest

```

```bash

go install -v github.com/owasp-amass/amass/v4/...@master

```

```bash

go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest

```

Inputs

| Variable | Required | Description |

|----------|----------|-------------|

| SECSKILL_TARGET_DOMAIN | required | Root domain to enumerate |

| SECSKILL_OUTPUT_DIR | optional | Path to save result files (default: ./output) |

| SECSKILL_USE_AMASS | optional | Set to true to also run amass (default: false) |

Workflow

Step 1: Prepare environment

export TARGET="${SECSKILL_TARGET_DOMAIN:?Set the SECSKILL_TARGET_DOMAIN environment variable}"
export OUTDIR="${SECSKILL_OUTPUT_DIR:-./output}"
mkdir -p "$OUTDIR"
echo "[*] Target domain: $TARGET"
echo "[*] Output directory: $OUTDIR"

Step 2: Run subfinder

echo "[*] Running subfinder..."
subfinder -d "$TARGET" \
  -silent \
  -o "$OUTDIR/subfinder_${TARGET}.txt"
echo "[+] subfinder complete: $(wc -l < "$OUTDIR/subfinder_${TARGET}.txt") results"

Step 3: Run amass (optional)

if [ "${SECSKILL_USE_AMASS:-false}" = "true" ]; then
  echo "[*] Running amass (this may take a while)..."
  amass enum -passive -d "$TARGET" \
    -o "$OUTDIR/amass_${TARGET}.txt"
  echo "[+] amass complete: $(wc -l < "$OUTDIR/amass_${TARGET}.txt") results"
else
  echo "[*] Skipping amass (enable with SECSKILL_USE_AMASS=true)"
fi

Step 4: Merge results and deduplicate

echo "[*] Merging results..."
cat "$OUTDIR"/subfinder_*.txt "$OUTDIR"/amass_*.txt 2>/dev/null \
  | sort -u \
  > "$OUTDIR/all_subdomains_${TARGET}.txt"
TOTAL=$(wc -l < "$OUTDIR/all_subdomains_${TARGET}.txt")
echo "[+] Total subdomains after deduplication: $TOTAL"

Step 5: Validate live hosts with httpx

echo "[*] Validating live hosts..."
httpx -l "$OUTDIR/all_subdomains_${TARGET}.txt" \
  -silent \
  -status-code \
  -title \
  -tech-detect \
  -o "$OUTDIR/live_subdomains_${TARGET}.txt"
LIVE=$(wc -l < "$OUTDIR/live_subdomains_${TARGET}.txt")
echo "[+] Live hosts: $LIVE"
echo "[+] Results saved to: $OUTDIR/live_subdomains_${TARGET}.txt"

Step 6: Print summary

echo ""
echo "===== Subdomain Enumeration Summary ====="
echo "Target domain : $TARGET"
echo "Total found   : $TOTAL"
echo "Live hosts    : $LIVE"
echo "Output files  : $OUTDIR/"
echo "========================================="

Done when

Failure modes

| Symptom | Cause | Resolution |

|---------|-------|------------|

| subfinder: command not found | Not installed | Check Go PATH and reinstall |

| 0 results | Invalid domain or network blocked | Verify domain, test DNS connectivity |

| httpx timeout | Network latency | Adjust with -timeout flag |

| amass taking too long | Active enumeration mode | Use -passive flag or disable amass |

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.