toolsjavascript8729
Multi-Source Subdomain Finder Scraper
Layanan scraper pelacak seluruh subdomain aktif dari target domain secara cepat menggunakan multi-source intelligence (Certificate Transparency, Subdomain Center, RapidDNS & CertSpotter).
Vamz Spectre27 Okt 2026169 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/subdomain-finder" -o subdomain-finder.js
# 2. Jalankan script
node subdomain-finder.js
Dependencies npm yang Dibutuhkan:
npm install []Panduan Penggunaan:
node subdomain-finder.js "bmkg.go.id"
subdomain-finder.js(169 lines)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/**
* Multi-Source Subdomain Finder Scraper
* Discover active subdomains for any target domain
*
* @author Vamz Spectre (https://vamxapi.my.id)
*
* Download:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/subdomain-finder" -o subdomain-finder.js
*
* Usage:
* node subdomain-finder.js "bmkg.go.id"
* node subdomain-finder.js "google.com"
*/
async function fetchSubdomainCenter(domain) {
try {
const res = await fetch(`https://api.subdomain.center/?domain=${encodeURIComponent(domain)}`, {
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" },
signal: AbortSignal.timeout(3500),
});
if (!res.ok) return [];
const data = await res.json();
return Array.isArray(data) ? data : [];
} catch {
return [];
}
}
async function fetchCertspotter(domain) {
try {
const res = await fetch(
`https://api.certspotter.com/v1/issuances?domain=${encodeURIComponent(domain)}&include_subdomains=true&expand=dns_names`,
{
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" },
signal: AbortSignal.timeout(3500),
}
);
if (!res.ok) return [];
const data = await res.json();
if (!Array.isArray(data)) return [];
const names = [];
for (const item of data) {
if (Array.isArray(item.dns_names)) {
for (const name of item.dns_names) {
if (typeof name === "string") names.push(name);
}
}
}
return names;
} catch {
return [];
}
}
async function fetchRapidDns(domain) {
try {
const res = await fetch(`https://rapiddns.io/subdomain/${encodeURIComponent(domain)}?full=1#result`, {
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
},
signal: AbortSignal.timeout(3000),
});
if (!res.ok) return [];
const html = await res.text();
const regex = new RegExp(`<td>([a-zA-Z0-9.-]+\\.${domain.replace(/\\./g, "\\\\.")})<\\/td>`, "g");
const matches = html.match(regex);
if (matches) {
return matches.map((m) => m.replace(/<\/?td>/g, ""));
}
} catch {
return [];
}
return [];
}
async function fetchCrtSh(domain) {
try {
const res = await fetch(`https://crt.sh/?q=%25.${encodeURIComponent(domain)}&output=json`, {
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" },
signal: AbortSignal.timeout(3000),
});
if (!res.ok) return [];
const data = await res.json();
if (!Array.isArray(data)) return [];
const names = [];
for (const item of data) {
if (typeof item.name_value === "string") {
const split = item.name_value.split("\n");
for (const s of split) {
if (s.trim()) names.push(s.trim());
}
}
}
return names;
} catch {
return [];
}
}
async function subdomainFinder(targetDomain) {
if (!targetDomain || typeof targetDomain !== "string") {
throw new Error("Target domain wajib disertakan. Contoh: 'bmkg.go.id'");
}
let cleanDomain = targetDomain.trim().toLowerCase();
cleanDomain = cleanDomain.replace(/^(?:https?:\/\/)?(?:www\.)?/i, "");
cleanDomain = cleanDomain.split("/")[0].split(":")[0].trim();
if (!cleanDomain || !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/i.test(cleanDomain)) {
throw new Error("Format domain tidak valid.");
}
const startTime = Date.now();
const results = await Promise.allSettled([
fetchSubdomainCenter(cleanDomain),
fetchCertspotter(cleanDomain),
fetchRapidDns(cleanDomain),
fetchCrtSh(cleanDomain),
]);
const subSet = new Set();
const domainSuffix = `.${cleanDomain}`;
for (const res of results) {
if (res.status === "fulfilled" && Array.isArray(res.value)) {
for (const item of res.value) {
if (!item || typeof item !== "string") continue;
let s = item.toLowerCase().trim();
s = s.replace(/^\*\./, "").trim();
if ((s.endsWith(domainSuffix) || s === cleanDomain) && /^[a-z0-9.-]+$/.test(s)) {
subSet.add(s);
}
}
}
}
const subdomains = Array.from(subSet).sort((a, b) => {
if (a === cleanDomain) return -1;
if (b === cleanDomain) return 1;
return a.localeCompare(b);
});
return {
status: true,
domain: cleanDomain,
total: subdomains.length,
elapsed_ms: Date.now() - startTime,
subdomains,
};
}
module.exports = { subdomainFinder };
// CLI Runner
if (require.main === module || process.argv[1]?.endsWith("subdomain-finder.js")) {
const domain = process.argv[2] || "bmkg.go.id";
subdomainFinder(domain)
.then((res) => {
console.log(JSON.stringify(res, null, 2));
})
.catch((err) => {
console.error(JSON.stringify({ status: false, error: err.message }, null, 2));
process.exit(1);
});
}