Skip to content

Instantly share code, notes, and snippets.

@lzjluzijie
Created February 25, 2024 07:55
Show Gist options
  • Save lzjluzijie/ca21d4734f2878ee56eae05575e89919 to your computer and use it in GitHub Desktop.
Save lzjluzijie/ca21d4734f2878ee56eae05575e89919 to your computer and use it in GitHub Desktop.
Cloudflare Warp 24PB key generator
# See https://halu.lu/%E6%9D%82%E8%B0%88/cloudflare-warp/
# Depolyed at https://warp.halu.lu/
// Change keys if needed
const keys = [
"9WO41D5p-6OP8xj27-36gQG75D",
"R65K12Up-aU907O2e-4nuvD581",
"06LM94EJ-1nl0V2d7-V847va5y",
]
const headers = {
'CF-Client-Version': 'a-6.11-2223',
'Host': 'api.cloudflareclient.com',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip',
'User-Agent': 'okhttp/3.12.1'
};
async function getKey() {
const r1 = await fetch('https://api.cloudflareclient.com/v0a2223/reg', {
method: 'POST',
headers
});
const json1 = await r1.json();
const id = json1.id;
const license = json1.account.license;
const token = json1.token;
const r2 = await fetch('https://api.cloudflareclient.com/v0a2223/reg', {
method: 'POST',
headers
});
const json2 = await r2.json();
const id2 = json2.id;
const token2 = json2.token;
const headersGet = { 'Authorization': `Bearer ${token}`, ...headers };
const headersGet2 = { 'Authorization': `Bearer ${token2}`, ...headers };
const headersPost = {
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': `Bearer ${token}`,
...headers
};
const patchJson = { 'referrer': `${id2}` };
await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id}`, {
method: 'PATCH',
headers: headersPost,
body: JSON.stringify(patchJson)
});
await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id2}`, {
method: 'DELETE',
headers: headersGet2
});
const key = keys[Math.floor(Math.random() * keys.length)];
const putJson1 = { 'license': `${key}` };
await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id}/account`, {
method: 'PUT',
headers: headersPost,
body: JSON.stringify(putJson1)
});
const putJson2 = { 'license': `${license}` };
await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id}/account`, {
method: 'PUT',
headers: headersPost,
body: JSON.stringify(putJson2)
});
const r3 = await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id}/account`, {
method: 'GET',
headers: headersGet
});
const json3 = await r3.json();
const accountType = json3.account_type;
const referralCount = json3.referral_count;
const updatedLicense = json3.license;
await fetch(`https://api.cloudflareclient.com/v0a2223/reg/${id}`, {
method: 'DELETE',
headers: headersGet
});
return updatedLicense;
}
export default {
async fetch(request, env, ctx) {
const key = await getKey();
console.log(key);
return new Response(key);
},
};
@lzjluzijie
Copy link
Author

Hi, @chocolatecandyman
Recently some people attacked my API and flushed with tons of requests, so I temporarily closed the API. I am working on a fix, and will notify you once it's done. Meanwhile, you can fork this code to deploy on your own, or used this following keys I just generated for you:

9ER32tM7-4vgDO703-GJ624Hk3
5t7jA38Z-3Z6Rr28y-4D8Bq6p3
Fdb521S8-2Q6w0tz9-W9c7V65S

@3z4k
Copy link

3z4k commented Aug 29, 2024

found 0 vulnerabilities
(node:44) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
/home/container/index.js:86
export default {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:128:18)
at wrapSafe (node:internal/modules/cjs/loader:1279:20)
at Module._compile (node:internal/modules/cjs/loader:1331:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Object.require.extensions. [as .js] (/usr/local/lib/node_modules/ts-node/src/index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Function.Module._load (node:internal/modules/cjs/loader:1021:12)
at cjsLoader (node:internal/modules/esm/translators:366:17)
at ModuleWrap. (node:internal/modules/esm/translators:315:7)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)

@3z4k
Copy link

3z4k commented Aug 29, 2024

also after i use es module the code doesn't generate keys
Screenshot 2024-08-29 2 21 39 PM

@3z4k
Copy link

3z4k commented Aug 29, 2024

@3z4k

// See https://halu.lu/%E6%9D%82%E8%B0%88/cloudflare-warp/
// Deployed at https://warp.halu.lu/

These URLs are not required for execution and are likely causing conflicts. After removing them, re-run the script. You will be able to get a key like this: 1625sQpy-9HE5m4t1-Y5R3j74V. However, the keys are no longer working in desktop Warp client, but works in mobile application.

i am trying to run the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment