Repository navigation
Expand file tree
/
Copy pathCoastingBot.lua
More file actions
309 lines (244 loc) · 12.5 KB
/
Copy pathCoastingBot.lua
File metadata and controls
309 lines (244 loc) · 12.5 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
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
local Discordia = require("discordia")
local Fs = require("fs")
local Json = require("json")
local PrettyPrint = require("pretty-print")
local Configuration = require("./Configuration.lua")
local Utilities = require("./Modules/Utilities.lua")
local Database = require("./Modules/Database.lua")
local Base64 = require("./Modules/Base64.lua")
local ShaHashing = require("./Modules/ShaHashing.lua")
local Purchases = require("./Modules/Purchases.lua")
local Client = Discordia.Client()
Discordia.extensions()
local FS = {
Writefile = Fs.writeFileSync,
Readfile = Fs.readFileSync,
UnlinkFile = Fs.unlink,
RenameFile = Fs.rename,
FileExists = Fs.existsSync
}
local Environment = {
Discordia = Discordia,
Client = Client,
Configuration = Configuration,
Utilities = Utilities,
Database = Database,
Base64 = Base64,
FS = FS,
Json = Json,
PrettyPrint = PrettyPrint,
Purchases = Purchases
}
for i, v in pairs(Environment) do
_G[i] = v
end
local CoastingScript = Json.decode(FS.Readfile("Flags/coastingscript.json")).coastingscript
local WeblitApp = require("./Weblit/weblit-app.lua")
WeblitApp.bind({host = "0.0.0.0", port = 444})
WeblitApp.use(require("./Weblit/weblit-auto-headers.lua"))
WeblitApp.route({method = "GET", path = "/coasting/getuser.lua", domain = ""}, function(request, response, go)
response.code = 200
response.headers = {}
if not request.query then response.body = "" return go() end
if not request.query["id"] then response.body = "" return go() end
local UserId = request.query["id"]
local Username = ""
local Success, Error = pcall(function() Username = Client:getUser(UserId).username end)
if Success then
response.body = Username
else
response.body = ""
end
return go()
end)
WeblitApp.route({method = "GET", path = "/coasting/gethardwareid.lua", domain = ""}, function(request, response, go)
response.code = 200
response.headers = {}
local HardwareId = ""
if request.headers["Syn-Fingerprint"] then
HardwareId = request.headers["Syn-Fingerprint"]
elseif request.headers["proto-user-identifier"] then
HardwareId = request.headers["proto-user-identifier"]
end
if HardwareId ~= "" then
HardwareId = Base64.Encode(ShaHashing.Sha(512, HardwareId))
end
response.body = HardwareId
return go()
end)
WeblitApp.route({method = "GET", path = "/coasting/getfile.lua", domain = ""}, function(request, response, go)
response.code = 200
response.headers = {}
if request.query == nil then response.body = "" return go() end
if not request.query["scriptid"] then response.body = "" return go() end
if not request.query["exploit"] then response.body = "" return go() end
if not request.query["scripttype"] then response.body = "" return go() end
if request.query["exploit"] == "SynapseX" then else response.body = "" return go() end
if request.query["scripttype"] == "main" or request.query["scripttype"] == "whitelister" then else response.body = "" return go() end
if not Database.IsUserInDatabase(Base64.Decode(request.query["scriptid"])) then response.body = "" return go() end
local ScriptId = request.query["scriptid"]
local Exploit = request.query["exploit"]
local ScriptType = request.query["scripttype"]
if ScriptType == "main" then
response.body = (Utilities.ScriptFileContent:format(ScriptId) .. "\n\n".. module:load("./CoastingScript/" .. Exploit .. ".lua"))
elseif ScriptType == "whitelister" then
response.body = (Utilities.ScriptFileContent:format(ScriptId) .. "\n\n".. module:load("./CoastingScript/" .. Exploit .. "Whitelister.lua"))
end
return go()
end)
WeblitApp.route({method = "GET", path = "/coasting/whitelister.lua", domain = ""}, function(request, response, go)
response.code = 200
response.headers = {}
CoastingScript = Json.decode(FS.Readfile("Flags/coastingscript.json")).coastingscript
if not CoastingScript then response.body = "[Whitelister]: Script is down." return go() end
if request.query == nil then response.body = "[Whitelister]: Failed to find request query." return go() end
if not request.query["hardwareid"] then response.body = "[Whitelister]: Failed to find hardwareid request query." return go() end
if not request.query["exploit"] then response.body = "[Whitelister]: Failed to find exploit request query." return go() end
if not request.query["scriptid"] then response.body = "[Whitelister]: Failed to find scriptid request query." return go() end
if request.query["exploit"] == "SynapseX" then else response.body = "[Whitelister]: Unsupported exploit." return go() end
if not Database.IsUserInDatabase(Base64.Decode(request.query["scriptid"])) then response.body = "[Whitelister]: Couldn't locate user in the database." return go() end
local HardwareId = request.query["hardwareid"]
local Exploit = request.query["exploit"]
local ScriptId = request.query["scriptid"]
local UserId = Base64.Decode(ScriptId)
local EncodedHardwareId = HardwareId
if Exploit == "SynapseX" then
Exploit = "Synapse X"
if Database.GetUserDataElement(UserId, "SynapseXHWID") ~= (nil or "") then response.body = "[Whitelister]: You are already whitelisted for Synapse X." return go() end
Database.ChangeUserDataElement(UserId, "SynapseXHWID", EncodedHardwareId)
end
response.body = (("[Whitelister]: You have successfully been whitelisted for %s, please DM the bot !getscript to start using Coasting."):format(Exploit))
Utilities.SendWebhook("https://discordapp.com/api/webhooks/740640460342558832/OJqJQ-OgBu7SvGkyxz6yJwM_-xPvYjilfQrC_4oJ06-B1H4LHDF1IJiBrWQtbLhk1Wfx", "Coasting Whitelists", {
"User:", Utilities.Constants.MentionUser:format(UserId),
"Hardware Id:", EncodedHardwareId,
"Script Id:", ScriptId,
"Exploit:", Exploit
}, "coasting whitelists")
return go()
end)
WeblitApp.route({method = "GET", path = "/coasting/authentication.lua", domain = ""}, function(request, response, go)
response.code = 200
response.headers = {}
CoastingScript = Json.decode(FS.Readfile("Flags/coastingscript.json")).coastingscript
if not CoastingScript then response.body = "Script is down" return go() end
if request.query == nil then response.body = "" return go() end
if request.headers == nil then response.body = "" return go() end
if not request.query["key"] then response.body = "" return go() end
if not request.query["scriptid"] then response.body = "" return go() end
if not request.query["hwid"] then response.body = "" return go() end
if not request.query["clientdata"] then response.body = "" return go() end
if request.headers["Exploit"] == "SynapseX" then else response.body = "" return go() end
if not request.headers["RobloxUser"] then response.body = "" return go() end
if not Database.IsUserInDatabase(Base64.Decode(request.query["scriptid"])) then response.body = "" return go() end
local Key = request.query["key"]
local ScriptId = request.query["scriptid"]
local HardwareId = request.query["hwid"]
local ClientData = request.query["clientdata"]
local Exploit = request.headers["Exploit"]
local RobloxUser = request.headers["RobloxUser"]
local UserId = Base64.Decode(ScriptId)
local AuthenticationClientKey = "mP.b,?_grGkkuq^cWvZ1tAu2NCo1L4tetLnpYM]kfRriCv!LEgaobWaYr23.7E4,}N+nei-Hcopt5-LFGQC5%jV>H2~5.c8zY>cB"
local AuthenticationServerKey = "~17*uzqa)MZ=*2Wc)Teu37kvwHyVw]^P^}-R]T8mx>qvB]?.a8]x#?TqK0RAw_T.qV55mz?Ff1!1bj~r=~:~ND_n>ypp*B]=^XQ]"
local ClientKeySplit = Utilities.SplitString(AuthenticationClientKey, 50)
local ServerKeySplit = Utilities.SplitString(AuthenticationServerKey, 50)
local UserHardwareId = ""
local ServerData = Base64.Encode(ClientKeySplit[1], ScriptId .. Key .. HardwareId .. ClientKeySplit[2])
local UserScriptId = Database.GetUserDataElement(UserId, "ScriptId")
local UserKey = Database.GetUserDataElement(UserId, "Key")
if Exploit == "SynapseX" then
Exploit = "Synapse X"
UserHardwareId = Database.GetUserDataElement(UserId, "SynapseXHWID")
end
function SendFailedLoginWebhook(reason)
Utilities.SendWebhook("https://discordapp.com/api/webhooks/739969471547965557/GEb_8WYlx4Y5swzfKWDlmV9Hvl3czrhEaV7amNY7QrAOVZeIGAk99sm0tz8mK9OdzXs3", "Coasting Logins", {
"User:", Utilities.Constants.MentionUser:format(UserId),
"Reason: ", reason,
"Key:", Key,
"Hardware Id:", HardwareId,
"Script Id:", ScriptId,
"Exploit:", Exploit,
"Roblox User:", RobloxUser,
}, "coasting logins")
end
if ScriptId == UserScriptId and Key == UserKey and HardwareId == UserHardwareId and ClientData == ServerData then
response.body = Base64.Encode(ServerKeySplit[1], ScriptId .. Key .. HardwareId .. ServerKeySplit[2])
Utilities.SendWebhook("https://discordapp.com/api/webhooks/739969348214587402/6csgABmF_27sy5uCtM5-lQz8R6FRSpGNExZpXde6HO9Y7vM0xYTShqDxYg635YETdBkh", "Coasting Logins", {
"User:", Utilities.Constants.MentionUser:format(UserId),
"Key:", Key,
"Hardware Id:", HardwareId,
"Script Id:", ScriptId,
"Exploit:", Exploit,
"Roblox User:", RobloxUser,
}, "coasting logins")
elseif ScriptId ~= UserScriptId then
response.body = "User Mismatch"
SendFailedLoginWebhook("User Mismatch")
elseif Key ~= UserKey then
response.body = "Invalid Key"
SendFailedLoginWebhook("Invalid Key")
elseif HardwareId ~= UserHardwareId then
response.body = "HWID Mismatch"
SendFailedLoginWebhook("HWID Mismatch")
elseif ClientData ~= ServerData then
response.body = "Data Mismatch"
SendFailedLoginWebhook("Data Mismatch")
end
Database.ChangeUserDataElement(UserId, "ClientKey", "")
Database.ChangeUserDataElement(UserId, "ServerKey", "")
return go()
end)
function CommandExists(command)
local CommandName = command:gsub("^%l", string.upper)
if FS.FileExists("./Commands/" .. CommandName .. ".lua") then
return true
else
return false
end
end
function LoadCommand(command)
local CommandName = command:gsub("^%l", string.upper)
local Environment = setmetatable({}, {__index = _G})
assert(pcall(setfenv(assert(loadfile("./Commands/" .. CommandName .. ".lua")), Environment)))
setmetatable(Environment, nil)
return Environment
end
Client:on("messageCreate", function(message)
pcall(function()
local Arguments = message.content:split(" ")
if Arguments[1]:find(Configuration.Prefix) then
local Command = Arguments[1]:gsub(Configuration.Prefix, "")
if CommandExists(Command) then
table.remove(Arguments, 1)
_G.Message = message
_G.Arguments = Arguments
LoadCommand(Command)
end
end
end)
end)
Client:on("memberJoin", function(member)
if not member.guild then return end
local Member = member.guild:getMember(member.id)
local WelcomeAndGoodbyeChannel = Client:getChannel(Configuration.Channels.WelcomeAndGoodbye)
local Success, Error = pcall(function()
Member:addRole(Configuration.Roles.Member)
Member:addRole(Configuration.Roles.Access)
end)
if Success then
WelcomeAndGoodbyeChannel:send("Yo wassup " .. Utilities.Constants.MentionUser:format(member.id) .. ", welcome to **Coasting**!")
elseif Error then
local Success2, Error2 = pcall(function()
Member:addRole(Configuration.Roles.Member)
Member:addRole(Configuration.Roles.Access)
end)
if Success2 then
WelcomeAndGoodbyeChannel:send("Yo wassup " .. Utilities.Constants.MentionUser:format(member.id) .. ", welcome to **Coasting**!")
end
end
end)
Client:on("memberLeave", function(member)
local WelcomeAndGoodbyeChannel = Client:getChannel(Configuration.Channels.WelcomeAndGoodbye)
WelcomeAndGoodbyeChannel:send(Utilities.Constants.MentionUser:format(member.id) .. " just left the server, see ya!")
end)
WeblitApp.start()
Client:run(Configuration.Token)