-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubdomain_finder.sh
More file actions
67 lines (53 loc) · 1.95 KB
/
Copy pathsubdomain_finder.sh
File metadata and controls
67 lines (53 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# 🛠 Subdomain Finder Tool - Enhanced
# 🔹 Author: Yash Tiwari
# 🔹 Usage: ./subdomain_finder.sh <domain>
# Check if a domain is provided
if [ -z "$1" ]; then
echo -e "\n🔴 Usage: $0 <domain>\n"
exit 1
fi
# Assign domain variable
DOMAIN=$1
OUTPUT_FILE="all_subdomains.txt"
TEMP_FILE="temp_subdomains.txt"
# Function to install missing tools
install_tool() {
TOOL=$1
INSTALL_CMD=$2
if ! [ -x "$(command -v $TOOL)" ]; then
echo -e "⚠️ $TOOL not found. Installing..."
eval "$INSTALL_CMD"
fi
}
# Install required tools if missing
install_tool "subfinder" "go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest"
install_tool "assetfinder" "go install -v github.com/tomnomnom/assetfinder@latest"
install_tool "amass" "go install -v github.com/OWASP/Amass/v3/...@latest"
# Start enumeration
echo -e "\n🔍 Starting subdomain enumeration for: $DOMAIN\n"
# Run tools in parallel
echo "▶️ Running subfinder..."
subfinder -d "$DOMAIN" -silent >> "$TEMP_FILE" &
echo "▶️ Running assetfinder..."
assetfinder --subs-only "$DOMAIN" >> "$TEMP_FILE" &
echo "▶️ Running amass..."
amass enum -passive -d "$DOMAIN" >> "$TEMP_FILE" &
# Wait for background processes to finish
wait
# Process results
echo -e "\n📌 Removing duplicates and saving results..."
sort -u "$TEMP_FILE" > "$OUTPUT_FILE"
rm "$TEMP_FILE"
echo -e "\n✅ Subdomain enumeration completed! Results saved in: $OUTPUT_FILE\n"
# Optional: Check for live subdomains
read -p "🔎 Do you want to check for live subdomains? (y/n): " answer
if [[ "$answer" == "y" ]]; then
if ! command -v httpx &> /dev/null; then
echo -e "⚠️ httpx not found. Installing..."
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
fi
echo -e "\n▶️ Checking live subdomains..."
cat "$OUTPUT_FILE" | httpx -silent > "live_subdomains.txt"
echo -e "\n✅ Live subdomains saved in: live_subdomains.txt\n"
fi