管理画面でも検索できます
See the Pen Cloudflare subdomain checker by John Doe (@04) on CodePen.
hogehoge.workers.dev
のhogehoge
部分を検索できます。
worker.js
export default {
async fetch(request, env, ctx) {
const subdomain = new URL(request.url).pathname.slice(1)
const response = new Response('', await fetch(`https://www.${subdomain}.workers.dev/`))
response.headers.set('Access-Control-Allow-Origin', '*')
return response
}
}
管理画面でサブドメイン変更できます
プログラムでサブドメインを探すこともできます
const n = 2
const chars = '0123456789abcdefghijklmnopqrstuvwxyz'
const charSet = [...Array(n).keys()].map(i => [...chars + (i>0 && i<n-1 ? '-' : '')])
for await (const subdomain of charSet.reduce((a,b)=>a.flatMap(x=>b.map(y=>x+y)),[''])) {
const res = await fetch('https://dash.cloudflare.com/api/v4/accounts/{account_id}/workers/subdomains/' + subdomain)
console.log(subdomain, res.status)
const sleep = msec => new Promise(resolve => setTimeout(resolve, msec));
await sleep(1000);
}