File size: 5,450 Bytes
71ed0f7 7e9ddb1 6fc5530 71ed0f7 7e9ddb1 a7ac1cd 7e9ddb1 a7ac1cd 7e9ddb1 |
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
const TURNSTILE_SOLVER_URL = 'https://herzaj-turnstile-solver.hf.space';
async function getTurnstileToken() {
try {
const params = new URLSearchParams({
url: 'https://www.subdomainfinder.in',
sitekey: '0x4AAAAAAAj7jyMV3Zv9ZMN-'
});
const submitResponse = await fetch(`${TURNSTILE_SOLVER_URL}/turnstile?${params}`, {
method: 'GET'
});
if (!submitResponse.ok) {
throw new Error(`Failed to submit task: ${submitResponse.status}`);
}
const taskData = await submitResponse.json();
const taskId = taskData.task_id;
await new Promise(resolve => setTimeout(resolve, 5000));
const resultResponse = await fetch(`${TURNSTILE_SOLVER_URL}/result?id=${taskId}`);
if (!resultResponse.ok) {
throw new Error(`Failed to get result: ${resultResponse.status}`);
}
const resultData = await resultResponse.json();
return resultData.value;
} catch (error) {
throw new Error("Gagal mendapatkan Turnstile token: " + error.message);
}
}
async function findSubdomains(domain, token) {
const response = await fetch(`https://api.subdomainfinder.in/?domain=${domain}`, {
method: 'GET',
headers: {
'X-Secure-Token': token,
'X-Referer': 'https://www.google.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
async function resolveDNS(subdomain) {
const response = await fetch(`https://lookup.subdomainfinder.in/resolve?name=${subdomain}&rd=1`, {
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
async function getIPInfo(ip) {
const response = await fetch(`https://ipresolver.subdomainfinder.in/${ip}`, {
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
function extractIPFromDNS(dnsData) {
if (!dnsData || !dnsData.Answer) return null;
for (const answer of dnsData.Answer) {
if (answer.type === 1 && answer.data) {
return answer.data;
}
}
return null;
}
async function subdo(domain) {
const token = await getTurnstileToken();
const subdomainData = await findSubdomains(domain, token);
const results = [];
for (const sub of subdomainData.data) {
try {
const dnsData = await resolveDNS(sub.subdomain);
const ip = extractIPFromDNS(dnsData);
let result = {
subdomain: sub.subdomain,
ip: ip || 'N/A',
cloudflare: sub.cloudflare,
dnsStatus: dnsData.Status
};
if (ip) {
try {
const ipInfo = await getIPInfo(ip);
if (ipInfo.success && ipInfo.result && ipInfo.result.ip) {
result.ipInfo = {
location: ipInfo.result.ip.locationName,
asn: ipInfo.result.ip.asnName,
country: ipInfo.result.ip.location,
flag: ipInfo.result.ip.flag
};
}
} catch (e) {
result.ipInfo = null;
}
}
results.push(result);
} catch (error) {
results.push({
subdomain: sub.subdomain,
error: error.message
});
}
}
return {
domain: domain,
count: subdomainData.count,
data: results
};
}
const handler = async (req, res) => {
try {
const { domain } = req.query;
if (!domain) {
return res.status(400).json({
success: false,
error: 'Missing required parameter: domain'
});
}
const domainRegex = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?\.([a-zA-Z]{2,}\.?)+$/;
if (!domainRegex.test(domain)) {
return res.status(400).json({
success: false,
error: 'Invalid domain format'
});
}
const result = await subdo(domain);
res.json({
success: true,
data: {
domain: result.domain,
total_subdomains: result.count,
subdomains: result.data
}
});
} catch (error) {
res.status(500).json({
success: false,
error: error.message
});
}
};
module.exports = {
name: 'Subdomain Finder',
description: 'Find subdomains with IP addresses and location information',
type: 'GET',
routes: ['api/tools/subdofinder'],
tags: ['security', 'subdomain', 'dns', 'recon'],
parameters: ['domain', 'key'],
enabled: true,
main: ['tools', 'Search'],
handler
}; |