This repository has been archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 144
/
index.js
624 lines (523 loc) · 24.1 KB
/
index.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
const sqlite = require("sqlite");
const sqlite3 = require("sqlite3");
const ChildProcess = require("child_process");
const path = require("path");
const SteamUser = require("steam-user");
const fs = require("fs");
const URL = require("url");
const Target = require("./helpers/Target.js");
const Helper = require("./helpers/Helper.js");
const Account = require("./helpers/account.js");
let config = null;
process.on("unhandledRejection", console.error);
process.on("uncaughtException", console.error);
const colors = {
reset: "\x1b[0m",
black: "\x1b[30m",
red: "\x1b[31m",
green: "\x1b[32m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
magenta: "\x1b[35m",
cyan: "\x1b[36m",
white: "\x1b[37m"
};
let helper = null;
let totalNeeded = 0;
let proxies = undefined;
let db = undefined;
let isNewVersion = false;
let totalSuccess = 0;
let totalFail = 0;
let _consolelog = console.log;
console.log = (color, ...args) => {
args.unshift(colors[color] ? colors[color] : color);
args.push(colors.reset);
_consolelog(...args);
}
(async () => {
if (!fs.existsSync("./config.json")) {
console.log("red", "Failed to find \"config.json\". Did you rename the file to \"config.json.json\"? Make sure to Enable Windows File Extensions");
return;
}
try {
config = require(path.resolve("config.json"));
} catch (err) {
let errPosition = err.message.split(": ").pop().trim();
let match = errPosition.match(/^Unexpected (?<type>.*) in JSON at position (?<position>.*)$/i);
if (!match || isNaN(parseInt(match.groups.position))) {
console.error(err);
} else {
let configRaw = fs.readFileSync("./config.json").toString();
let part = configRaw.slice(0, parseInt(match.groups.position));
let lines = part.split("\n").map(l => l.trim()).filter(l => l.length > 0);
console.log("red", "Failed to parse \"config.json\":\nError description: " + errPosition + "\nError on line: " + lines.length + "\nText which caused the error: " + lines.pop());
console.log("red", "Please verify your \"config.json\" and take the \"config.json.example\" file for help")
}
return;
}
helper = new Helper(config.steamWebAPIKey);
if (config.type && config.type.toUpperCase() === "REPORT") {
totalNeeded = Math.max(config.report.aimbot, config.report.wallhack, config.report.speedhack, config.report.teamharm, config.report.abusive);
} else {
totalNeeded = Math.max(config.commend.friendly, config.commend.teaching, config.commend.leader);
}
if (typeof config.type === "undefined") {
config.type = "COMMEND";
}
if (!["LOGIN", "SERVER"].includes(config.method.toUpperCase())) {
console.log("red", "The \"method\" option only allows for \"LOGIN\" or \"SERVER\" value. Please refer to the README for more information.");
return;
}
if (!["REPORT", "COMMEND"].includes(config.type.toUpperCase())) {
console.log("red", "The \"type\" option only allows for \"REPORT\" or \"COMMEND\" value. Please refer to the README for more information.");
return;
}
if (config.method.toUpperCase() === "LOGIN" && config.type.toUpperCase() === "REPORT") {
console.log("red", "You cannot use the \"REPORT\" type and \"LOGIN\" method at the same time. You wouldn't want to report yourself?");
return;
}
if (!config.disableUpdateCheck) {
console.log("white", "Checking for new update...");
try {
let package = require("./package.json");
if (!fs.existsSync("./data/dev")) {
if (fs.existsSync("./data/version")) {
let version = fs.readFileSync("./data/version").toString();
isNewVersion = version !== package.version;
}
if (!fs.existsSync("./data")) {
fs.mkdirSync("./data");
}
fs.writeFileSync("./data/version", package.version);
}
let res = await helper.GetLatestVersion().catch(console.error);
if (package.version !== res) {
let repoURL = package.repository.url.split(".");
repoURL.pop();
console.log("red", "A new version is available on Github @ " + repoURL.join("."));
console.log("red", "Downloading is optional but recommended. Make sure to check if there are any new values to be added in your old \"config.json\"");
await new Promise(p => setTimeout(p, 5000));
} else {
console.log("green", "Up to date!");
}
} catch (err) {
console.error(err);
console.log("red", "Failed to check for updates");
}
} else {
console.log("white", "Update check skipped");
}
console.log("white", "Checking protobufs...");
let foundProtobufs = helper.verifyProtobufs();
if (foundProtobufs && !isNewVersion) {
console.log("green", "Found protobufs");
} else {
console.log("red", isNewVersion ? "New version detected, updating protobufs..." : "Failed to find protobufs, downloading and extracting...");
await helper.downloadProtobufs(__dirname);
}
if (config.proxy && config.proxy.file && config.proxy.switchProxyEveryXaccounts && config.proxy.enabled) {
console.log("white", "Loading proxies...");
let proxyFilePath = path.resolve(config.proxy.file);
if (!fs.existsSync(proxyFilePath)) {
console.log("red", "Could not find proxy file \"" + config.proxy.file + "\" (" + proxyFilePath + ")");
return;
}
let proxiesRaw = fs.readFileSync(proxyFilePath).toString();
try {
proxies = JSON.parse(proxiesRaw);
} catch {
proxies = proxiesRaw.split("\n").map((l) => {
l = l.trim();
return l;
}).filter((l) => {
return l.length > 0;
});
}
proxies = proxies.map((proxy) => {
try {
let url = new URL.URL(proxy);
url.protocol = "http:"; // Force HTTP protcol
return url.href;
} catch {
if (!proxy.startsWith("http://")) {
proxy = "http://" + proxy;
}
return proxy;
}
});
console.log("green", "Got " + proxies.length + " prox" + (proxies.length === 1 ? "y" : "ies"));
} else {
proxies = [];
}
console.log("white", "Opening database...");
db = await sqlite.open({
filename: "./accounts.sqlite",
driver: sqlite3.Database
});
await Promise.all([
db.run("CREATE TABLE IF NOT EXISTS \"accounts\" (\"username\" TEXT NOT NULL UNIQUE, \"password\" TEXT NOT NULL, \"sharedSecret\" TEXT, \"lastCommend\" INTEGER NOT NULL DEFAULT -1, \"operational\" NUMERIC NOT NULL DEFAULT 1, PRIMARY KEY(\"username\"))"),
db.run("CREATE TABLE IF NOT EXISTS \"commended\" (\"username\" TEXT NOT NULL REFERENCES accounts(username), \"commended\" INTEGER NOT NULL, \"timestamp\" INTEGER NOT NULL)")
]);
let amount = await db.get("SELECT COUNT(*) FROM accounts WHERE operational = 1;");
console.log("white", "There are a total of " + amount["COUNT(*)"] + " operational accounts");
if (amount["COUNT(*)"] < totalNeeded) {
console.log("red", "Not enough accounts available, got " + amount["COUNT(*)"] + "/" + totalNeeded);
return;
}
let targetAcc = undefined;
let serverToUse = undefined;
let matchID = config.matchID;
if (config.method.toUpperCase() === "LOGIN") {
console.log("white", "Logging into target account");
targetAcc = new Target(config.protocol);
await targetAcc.login(config.account.username, config.account.password, config.account.sharedSecret);
} else if (config.method.toUpperCase() === "SERVER") {
console.log("white", "Parsing target account...");
targetAcc = (await helper.parseSteamID(config.target)).accountid;
}
let accountsToUse = await db.all("SELECT accounts.username, accounts.password, accounts.sharedSecret FROM accounts LEFT JOIN commended ON commended.username = accounts.username WHERE accounts.username NOT IN (SELECT username FROM commended WHERE commended = " + (typeof targetAcc === "object" ? targetAcc.accountid : targetAcc) + " OR commended.username IS NULL) AND (" + Date.now() + " - accounts.lastCommend) >= " + config.cooldown + " AND accounts.operational = 1 GROUP BY accounts.username LIMIT " + totalNeeded);
if (accountsToUse.length < totalNeeded) {
console.log("red", "Not enough accounts available, got " + accountsToUse.length + "/" + totalNeeded);
if (targetAcc instanceof Target) {
targetAcc.logOff();
}
await db.close();
// Force exit the process if it doesn't happen automatically within 15 seconds
setTimeout(process.exit, 15000, 1).unref();
return;
}
// Inject what to commend with in our accounts
let proxySwitch = 0;
if (config.type.toUpperCase() === "REPORT") {
for (let i = 0; i < accountsToUse.length; i++) {
let chosen = accountsToUse.filter(a => typeof a.report === "object").length;
if (i > 0 && (i % config.proxy.switchProxyEveryXaccounts) === 0 && config.proxy && config.proxy.enabled) {
proxySwitch++;
if (proxySwitch >= proxies.length) {
proxySwitch = 0;
}
}
accountsToUse[i].proxy = proxies[proxySwitch];
accountsToUse[i].report = {
rpt_aimbot: config.report.aimbot > chosen ? true : false,
rpt_wallhack: config.report.wallhack > chosen ? true : false,
rpt_speedhack: config.report.speedhack > chosen ? true : false,
rpt_teamharm: config.report.teamharm > chosen ? true : false,
rpt_textabuse: config.report.abusive > chosen ? true : false
}
}
} else {
for (let i = 0; i < accountsToUse.length; i++) {
let chosen = accountsToUse.filter(a => typeof a.commend === "object").length;
if (i > 0 && (i % config.proxy.switchProxyEveryXaccounts) === 0 && config.proxy && config.proxy.enabled) {
proxySwitch++;
}
accountsToUse[i].proxy = proxies[proxySwitch];
accountsToUse[i].commend = {
friendly: config.commend.friendly > chosen ? true : false,
teaching: config.commend.teaching > chosen ? true : false,
leader: config.commend.leader > chosen ? true : false
}
}
}
console.log("white", "Chunking " + accountsToUse.length + " account" + (accountsToUse.length === 1 ? "" : "s") + " into groups of " + config.perChunk + "...");
let chunks = helper.chunkArray(accountsToUse, config.perChunk);
if (config.method.toUpperCase() === "LOGIN") {
console.log("white", "Getting an available server");
serverToUse = (await helper.GetActiveServer()).shift().steamid;
console.log("white", "Selected available server " + serverToUse);
targetAcc.setGamesPlayed(serverToUse).catch(() => { });
} else if (config.method.toUpperCase() === "SERVER") {
console.log("white", "Parsing server input");
if (config.serverID.toUpperCase() !== "AUTO") {
serverToUse = await helper.parseServerID(config.serverID).catch(console.error);
if (!serverToUse) {
console.log("red", "Could not find online server for " + config.serverID);
if (targetAcc instanceof Target) {
targetAcc.logOff();
}
await db.close();
// Force exit the process if it doesn't happen automatically within 15 seconds
setTimeout(process.exit, 15000, 1).unref();
return;
}
console.log("white", "Parsed server input to " + serverToUse);
}
if (config.serverID.toUpperCase() === "AUTO" || config.matchID.toUpperCase() === "AUTO") {
matchID = config.matchID.toUpperCase() === "AUTO" ? null : config.matchID;
let serverID = config.serverID.toUpperCase() === "AUTO" ? null : config.serverID;
console.log("blue", "Logging into fetcher account...");
let fetcher = new Account(config.fetcher.askSteamGuard, undefined, config.protocol);
await fetcher.login(config.fetcher.username, config.fetcher.password, config.fetcher.sharedSecret);
console.log("blue", "Trying to fetch target " + config.fetcher.maxTries + " time" + (config.fetcher.maxTries === 1 ? "" : "s") + " with a delay of " + config.fetcher.tryDelay + "ms");
let tries = 0;
while (!serverToUse) {
tries++;
if (tries > config.fetcher.maxTries) {
console.log("red", "Failed to find server after " + tries + " tr" + (tries === 1 ? "y" : "ies"));
break;
}
// Community Server
serverToUse = await fetcher.getTargetServer(targetAcc).catch((err) => {
if (err.message) {
console.log("red", err.message);
} else {
console.error(err);
}
});
if (!serverToUse) {
// Valve Server
serverToUse = await fetcher.getTargetServerValve(targetAcc).catch((err) => {
if (err.message) {
console.log("red", err.message);
} else {
console.error(err);
}
});
if (!serverToUse) {
await new Promise(p => setTimeout(p, config.fetcher.tryDelay));
}
}
}
if (!serverToUse) {
await db.close();
// Force exit the process if it doesn't happen automatically within 15 seconds
setTimeout(process.exit, 15000, 1).unref();
return;
}
serverID = serverID === null ? (serverToUse.serverID || "0") : serverID;
matchID = matchID === null ? (serverToUse.matchID || "0") : matchID;
console.log("green", "Found target on " + (serverToUse.isValve ? "Valve" : "Community") + " server " + serverID + " after " + tries + " tr" + (tries === 1 ? "y" : "ies") + " " + (matchID === "0" ? "" : ("(" + matchID + ")")));
if (config.autoReportOnMatchEnd && serverToUse.isValve && config.type.toUpperCase() === "REPORT") {
console.log("cyan", "Waiting until match is over before reporting...");
let inMatch = true;
while (inMatch) {
inMatch = await fetcher.getTargetQueuedMatch(targetAcc).catch(() => {
// This should never error
inMatch = true;
});
if (inMatch) {
await new Promise(p => setTimeout(p, 500));
}
}
console.log("green", "Match has ended, starting report bot...");
}
serverToUse = serverID;
fetcher.logOff();
}
}
// Get current commend count
let startCommends = {
friendly: 0,
teaching: 0,
leader: 0
};
if (config.showCommends && config.type.toUpperCase() === "COMMEND") {
console.log("blue", "Logging into fetcher account for commend count...");
let fetcher = new Account(config.fetcher.askSteamGuard, undefined, config.protocol);
await fetcher.login(config.fetcher.username, config.fetcher.password, config.fetcher.sharedSecret);
startCommends = await fetcher.getCurrentCommendCount(targetAcc instanceof Target ? targetAcc.accountid : targetAcc);
console.log("yellow", "Current target commends: F" + startCommends.friendly + " T" + startCommends.teaching + " L" + startCommends.leader);
fetcher.logOff();
}
// Start commending
for (let i = 0; i < chunks.length; i++) {
if (i !== 0 && i % (config.switchServerAfterChunks || Number.MAX_SAFE_INTEGER) === 0 && config.method.toUpperCase() === "LOGIN") {
console.log("white", "Getting an available server after " + config.switchServerAfterChunks + " chunk" + (config.switchServerAfterChunks === 1 ? "" : "s"));
try {
let oldServer = serverToUse;
while (oldServer === serverToUse || !serverToUse) {
serverToUse = await helper.GetActiveServer().shift().steamid;
if (serverToUse === oldServer) {
console.log("red", "Old and new server are the same, retrying...");
}
}
console.log("white", "Selected available server " + serverToUse);
} catch {
console.log("red", "Failed to fetch new server, continuing with old server " + serverToUse);
}
targetAcc.setGamesPlayed(serverToUse).catch(() => { });
}
console.log("white", "Logging in on chunk " + (i + 1) + "/" + chunks.length);
// Do commends
let result = await handleChunk(chunks[i], (targetAcc instanceof Target ? targetAcc.accountid : targetAcc), serverToUse, matchID);
totalSuccess += result.success.length;
totalFail += result.error.length;
console.log("white", "Chunk " + (i + 1) + "/" + chunks.length + " finished with " + result.success.length + " successful " + (config.type.toUpperCase() === "REPORT" ? "report" : "commend") + (result.success.length === 1 ? "" : "s") + " and " + result.error.length + " failed " + (config.type.toUpperCase() === "REPORT" ? "report" : "commend") + (result.error.length === 1 ? "" : "s"));
// Wait a little bit and relog target if needed
if ((i + 1) < chunks.length) {
console.log("yellow", "Waiting " + config.betweenChunks + "ms...");
await new Promise(r => setTimeout(r, config.betweenChunks));
}
}
// We are done here!
if (config.showCommends && config.type.toUpperCase() === "COMMEND") {
console.log("blue", "Logging into fetcher account for commend count...");
let fetcher = new Account(config.fetcher.askSteamGuard, undefined, config.protocol);
await fetcher.login(config.fetcher.username, config.fetcher.password, config.fetcher.sharedSecret);
let commends = await fetcher.getCurrentCommendCount(targetAcc instanceof Target ? targetAcc.accountid : targetAcc);
console.log("yellow", "Current target commends: F" + commends.friendly + " T" + commends.teaching + " L" + commends.leader);
let diffCommends = {
friendly: commends.friendly - startCommends.friendly,
teaching: commends.teaching - startCommends.teaching,
leader: commends.leader - startCommends.leader
};
console.log("yellow", "Change:");
console.log("yellow", "- F " + (diffCommends.friendly >= 0 ? ("+" + diffCommends.friendly) : diffCommends.friendly));
console.log("yellow", "- T " + (diffCommends.teaching >= 0 ? ("+" + diffCommends.teaching) : diffCommends.teaching));
console.log("yellow", "- L " + (diffCommends.leader >= 0 ? ("+" + diffCommends.leader) : diffCommends.leader));
fetcher.logOff();
}
if (targetAcc instanceof Target) {
targetAcc.logOff();
}
await db.close();
console.log("magenta", "Finished all chunks with a total of " + totalSuccess + " successful and " + totalFail + " failed " + (config.type.toUpperCase() === "REPORT" ? "report" : "commend") + (totalFail === 1 ? "" : "s"));
// Force exit the process if it doesn't happen automatically within 15 seconds
setTimeout(process.exit, 15000, 1).unref();
})();
function handleChunk(chunk, target, serverSteamID, matchID) {
return new Promise(async (resolve, reject) => {
let child = ChildProcess.fork("./Bots.js", [], {
cwd: path.join(__dirname, "helpers"),
execArgv: process.execArgv.join(" ").includes("--inspect") ? ["--inspect=0"] : []
});
child.on("error", console.error);
let res = {
success: [],
error: []
};
child.on("message", async (msg) => {
switch (msg.type) {
case "ready": {
child.send({
isCommend: config.type.toUpperCase() === "COMMEND",
isReport: config.type.toUpperCase() === "REPORT",
protocol: config.protocol,
chunk: chunk,
target: target,
serverSteamID: serverSteamID,
matchID: matchID
});
break;
}
case "error": {
console.error("The child has exited due to an error", msg.error);
break;
}
case "logging": {
console.log("yellow", "[" + msg.username + "] Logging into Steam");
break;
}
case "loggedOn": {
console.log("cyan", "[" + msg.username + "] Logged onto Steam - GC Time: " + new Date(msg.hello.rtime32_gc_welcome_timestamp * 1000).toLocaleString());
break;
}
case "authError": {
console.log("red", "[" + msg.username + "] Failed to authenticate to target server");
res.error.push({
account: msg.username,
error: msg.error
});
break;
}
case "auth": {
console.log("magenta", "[" + msg.username + "] Authenticated with target server with ticket " + msg.crc);
break;
}
case "commended":
case "reported": {
await db.run("UPDATE accounts SET lastCommend = ? WHERE username = ?", Date.now(), msg.username).catch(() => { });
if (msg.response.response_result === 2 && msg.type === "commended") {
// Already commended
res.error.push({
account: msg.username,
error: msg.response
});
console.log("red", "[" + msg.username + "] Got response code " + msg.response.response_result + ", already commended target (" + (res.error.length + res.success.length) + "/" + chunk.length + ")");
await db.run("INSERT INTO commended (username, commended, timestamp) VALUES (?, ?, ?)", msg.username, target, Date.now()).catch(() => { });
break;
}
if (msg.response.response_result === 1) {
// Success commend
res.success.push({
account: msg.username,
response: msg.response
});
if (msg.type === "commended") {
console.log("green", "[" + msg.username + "] Successfully sent a commend with response code " + msg.response.response_result + " - Remaining Commends: " + msg.response.tokens + " (" + (res.error.length + res.success.length) + "/" + chunk.length + ")");
} else {
console.log("green", "[" + msg.username + "] Successfully sent a report with response code " + msg.response.response_result + " - " + msg.confirmation + " (" + (res.error.length + res.success.length) + "/" + chunk.length + ")");
}
await db.run("INSERT INTO commended (username, commended, timestamp) VALUES (?, ?, ?)", msg.username, target, Date.now()).catch(() => { });
break;
}
// Unknown response code
res.error.push({
account: msg.username,
error: msg.response
});
console.log("red", "[" + msg.username + "] " + (config.type.toUpperCase() === "REPORT" ? "Reported" : "Commended") + " but got invalid success code " + msg.response.response_result + " (" + (res.error.length + res.success.length) + "/" + chunk.length + ")");
break;
}
case "commendErr":
case "reportErr": {
res.error.push({
account: msg.username,
error: msg.error
});
console.log("red", "[" + msg.username + "] Failed to " + (config.type.toUpperCase() === "REPORT" ? "report" : "commend") + " (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET lastCommend = ? WHERE username = ?", Date.now(), msg.username).catch(() => { });
break;
}
case "halfwayError": {
console.log("red", "[" + msg.username + "] Fatal error after logging in and has been marked as invalid (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET operational = 0 WHERE username = ?", msg.username);
break;
}
case "failLogin": {
res.error.push({
account: msg.username,
error: msg.error
});
let ignoreCodes = [
SteamUser.EResult.Fail,
SteamUser.EResult.InvalidPassword,
SteamUser.EResult.AccessDenied,
SteamUser.EResult.Banned,
SteamUser.EResult.AccountNotFound,
SteamUser.EResult.Suspended,
SteamUser.EResult.AccountLockedDown,
SteamUser.EResult.IPBanned,
SteamUser.EResult.AccountDisabled
];
if (typeof msg.error.eresult === "number" && !ignoreCodes.includes(msg.error.eresult)) {
console.log("red", "[" + msg.username + "] Failed to login (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
} else if (msg.error && msg.error.message === "Steam Guard required") {
console.log("red", "[" + msg.username + "] Requires a Steam Guard code and has been marked as invalid (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET operational = 0 WHERE username = ?", msg.username);
} else if (msg.error && msg.error.message === "VAC Banned") {
console.log("red", "[" + msg.username + "] Has been VAC banned in CSGO and has been marked as invalid (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET operational = 0 WHERE username = ?", msg.username);
} else if (msg.error && msg.error.message === "Game Banned") {
console.log("red", "[" + msg.username + "] Has been Game banned in CSGO and has been marked as invalid (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET operational = 0 WHERE username = ?", msg.username);
} else {
// Add more possible errors which occur if proxies are not working correctly
if (((typeof msg.error.message === "string" && /^HTTP CONNECT \d+.*$/i.test(msg.error.message)) || ["Failed to log in within given 60000ms", "Proxy connection timed out"].includes(msg.error.message) || ["ETIMEDOUT"].includes(msg.error.code)) && config.proxy.enabled) {
console.log("red", "[" + msg.username + "] Failed to login and due to proxy timeout (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
} else {
console.log("red", "[" + msg.username + "] Failed to login and has been marked as invalid (" + (res.error.length + res.success.length) + "/" + chunk.length + ")", msg.error);
await db.run("UPDATE accounts SET operational = 0 WHERE username = ?", msg.username);
}
}
break;
}
}
});
child.on("exit", () => {
resolve(res);
});
});
}