1
1

Cloudflare workersの空きサブドメイン(○○.workers.dev)を検索

Last updated at Posted at 2023-10-28

管理画面でも検索できます

See the Pen Cloudflare subdomain checker by John Doe (@04) on CodePen.

hogehoge.workers.devhogehoge部分を検索できます。

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
  }
}

管理画面でサブドメイン変更できます

image.png

プログラムでサブドメインを探すこともできます

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);
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1