Created
January 6, 2024 17:57
-
-
Save mmkhitaryan/5603360b2002e8fb520203a2195f3f9d to your computer and use it in GitHub Desktop.
I wanted to find free 2 character netlify subdomain name, but found no :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
function generateRandomString() { | |
const randomChar1 = String.fromCharCode(Math.floor(Math.random() * 26) + 65); // Random uppercase letter | |
const randomChar2 = String.fromCharCode(Math.floor(Math.random() * 26) + 65); // Another random uppercase letter | |
// Concatenate the two characters | |
const randomString = randomChar1 + randomChar2; | |
return randomString.toLowerCase(); | |
} | |
async function try_change_domain(name){ | |
try { | |
await fetch("https://app.netlify.com/access-control/bb-api/api/v1/sites/fa0f71cb-79d7-4330-a376-7487a6525fac", { | |
"headers": { | |
"accept": "*/*", | |
"accept-language": "en-US,en;q=0.9,ru;q=0.8,ja;q=0.7", | |
"content-type": "application/json", | |
"sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"", | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": "\"Windows\"", | |
"sec-fetch-dest": "empty", | |
"sec-fetch-mode": "cors", | |
"sec-fetch-site": "same-origin" | |
}, | |
"referrer": "https://app.netlify.com/sites/mmkh/configuration/general", | |
"referrerPolicy": "no-referrer-when-downgrade", | |
"body": JSON.stringify({"name": name}), | |
"method": "PUT", | |
"mode": "cors", | |
"credentials": "include" | |
}); | |
if (response.status === 422) { | |
return false | |
} | |
return true | |
} | |
catch {return false} | |
} | |
async function main_loop() { | |
domain = generateRandomString() | |
while (true){ | |
result = await try_change_domain(domain) | |
console.log(result) | |
if (result==true) {return} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment