Skip to content

Instantly share code, notes, and snippets.

@smhuda
Created June 23, 2025 14:27
Show Gist options
  • Select an option

  • Save smhuda/5be900db8670b8bb44512fab31bed106 to your computer and use it in GitHub Desktop.

Select an option

Save smhuda/5be900db8670b8bb44512fab31bed106 to your computer and use it in GitHub Desktop.
Run Sublist3r for the a domain from list of domains.txt and wait for it to finish, then run the next one. Append results to final output subdomaints.txt file with domain header
#!/bin/bash
INPUT_FILE="domains.txt"
OUTPUT_FILE="all_subdomains.txt"
# Clear or create output file
> "$OUTPUT_FILE"
while read -r domain; do
if [[ -n "$domain" ]]; then
echo "[*] Enumerating subdomains for: $domain"
TEMP_FILE="${domain}_subs.txt"
# Run Sublist3r for the domain and wait for it to finish
sublist3r -d "$domain" -o "$TEMP_FILE"
# Append results to final output with domain header
echo "### $domain" >> "$OUTPUT_FILE"
cat "$TEMP_FILE" >> "$OUTPUT_FILE"
echo -e "\n" >> "$OUTPUT_FILE"
# Optional: remove temp file
rm -f "$TEMP_FILE"
fi
done < "$INPUT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment