forked from rcon420/GSLT-Token-Generator-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.js
More file actions
47 lines (38 loc) · 1.4 KB
/
Copy pathtoken.js
File metadata and controls
47 lines (38 loc) · 1.4 KB
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
const fetch = require('node-fetch');
const fs = require('fs');
const API_KEY = 'YOURSTEAMAPIKEYHERE';
const APP_ID = 730; // CS2
const BASE_MEMO = 'CS2-GSLT';
const COUNT = 980; // Set count to 980 tokens
const OUTPUT_FILE = 'generated_tokens.txt';
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
// Create output file or clear it if already exists
fs.writeFileSync(OUTPUT_FILE, '', 'utf-8');
async function createToken(index) {
const memo = `${BASE_MEMO}-${index + 1}`;
const url = `https://api.steampowered.com/IGameServersService/CreateAccount/v1/?key=${API_KEY}&appid=${APP_ID}&memo=${encodeURIComponent(memo)}`;
try {
const res = await fetch(url, { method: 'POST' });
const json = await res.json();
if (res.ok && json.response && json.response.login_token) {
const token = json.response.login_token;
console.log(`✅ Token ${index + 1}: ${token}`);
// Immediately append to file
fs.appendFileSync(OUTPUT_FILE, token + '\n', 'utf-8');
return token;
} else {
console.error(`❌ Failed at index ${index + 1}:`, json);
return null;
}
} catch (err) {
console.error(`❌ Error at index ${index + 1}:`, err);
return null;
}
}
(async () => {
for (let i = 0; i < COUNT; i++) {
await createToken(i);
await delay(1000); // Delay between requests
}
console.log(`\n✅ Finished. Tokens saved to ${OUTPUT_FILE}`);
})();