R

protektio frm malixious attaxks

public
rrixh Oct 27, 2023 Never 62
Clone
Plaintext protekioV1_lulaslollipop 321 lines (305 loc) | 10.84 KB
1
if not game:IsLoaded() then
2
game.IsLoaded:Wait()
3
end
4
function String2Table(str)
5
if type(str) == "string" then
6
local length = #str
7
local count = 1
8
local String = {}
9
while not (#String == length) do
10
String[count] = str:sub(count, count)
11
count = count + 1
12
end
13
return String
14
end
15
end
16
local Players = game:GetService("Players")
17
local LocalPlayer = game:GetService("Players").LocalPlayer
18
local func = function()
19
for i, v in next, workspace:GetDescendants() do
20
if v:IsA("Model") and v.Name == LocalPlayer.Name and Players:GetPlayerFromCharacter(v) == LocalPlayer then
21
return v
22
end
23
end
24
end
25
26
27
local Character = func()
28
if game:GetService("TextChatService").ChatVersion == Enum.ChatVersion.LegacyChatService then
29
chat = "legacy"
30
ChatBar = LocalPlayer.PlayerGui.Chat.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar
31
chatMain = game:GetService("Players").LocalPlayer.PlayerScripts.ChatScript.ChatMain
32
33
lastText = ""
34
function makeMessage(message)
35
msg = tostring(message)
36
game:GetService("StarterGui"):SetCore(
37
"ChatMakeSystemMessage",
38
{
39
Text = msg,
40
Color = Color3.fromRGB(255, 89, 98),
41
Font = Enum.Font.GothamMedium,
42
FontSize = 16
43
}
44
)
45
end
46
function makeWarn(message)
47
msg = tostring(message)
48
game:GetService("StarterGui"):SetCore(
49
"ChatMakeSystemMessage",
50
{
51
Text = "[WARN]\n" .. msg,
52
Color = Color3.fromHex("#fdfd96"),
53
Font = Enum.Font.GothamMedium,
54
FontSize = 16
55
}
56
)
57
end
58
function makeError(message)
59
msg = tostring(message)
60
game:GetService("StarterGui"):SetCore(
61
"ChatMakeSystemMessage",
62
{
63
Text = "[ERROR]\n" .. msg,
64
Color = Color3.fromRGB(125, 12, 23),
65
Font = Enum.Font.GothamMedium,
66
FontSize = 16
67
}
68
)
69
end
70
makeMessage("Protectio loaded.")
71
if not game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents:FindFirstChild("SayMessageRequest") then
72
makeError("Could not find SayMessageRequest, Please send a message in chat to fix this and prevent chat bans.")
73
else
74
SMR = game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents:FindFirstChild("SayMessageRequest")
75
end
76
else
77
chat = "tcs"
78
function makeMessage(msg)
79
msg = tostring(msg)
80
if game:GetService("TextChatService").TextChannels:FindFirstChild("RBXGeneral") then
81
game:GetService("TextChatService").TextChannels:FindFirstChild("RBXGeneral"):DisplaySystemMessage(msg)
82
end
83
end
84
function makeWarn(msg)
85
msg = tostring(msg)
86
if game:GetService("TextChatService").TextChannels:FindFirstChild("RBXGeneral") then
87
game:GetService("TextChatService").TextChannels:FindFirstChild("RBXGeneral"):DisplaySystemMessage(
88
"[WARN] " .. msg
89
)
90
end
91
end
92
function makeError(msg)
93
makeMessage("[ERROR]\n" .. msg)
94
end
95
makeMessage("Protectio loaded.")
96
end
97
local function gcs()
98
if getcallingscript() ~= nil then
99
return getcallingscript():GetFullName()
100
else
101
return "Unknown script"
102
end
103
end
104
local r = true
105
106
Protectio = {
107
AllowSendAsync = false,
108
HttpOptions = {
109
HttpGet = {Enabled = true, allowedURLs = {
110
"https://scriptblox.com",
111
}
112
},
113
HttpPost = {Enabled = false, allowedURLs = {}}
114
},
115
Request = {Enabled = false},
116
AllowClientKick = false,
117
AllowReportAbuse = false,
118
AllowCaptureFocus = false,
119
AllowSayMessageRequest = false,
120
AllowAccessFriends = false,
121
AllowKeyPresses = true
122
}
123
124
OnAttemptDeny = {
125
CopyURLs = false,
126
CopyReportAbuse = false
127
}
128
129
local hook
130
hook =
131
hookmetamethod(
132
game,
133
"__namecall",
134
function(Self, ...)
135
local args, method = {...}, getnamecallmethod()
136
if Protectio[1] == false and method == "SendAsync" and Self:IsA("TextChannel") then
137
return makeWarn(gcs() .. " tried to SendAsync with the message " .. args[1] .. " in channel " .. Self.Name)
138
end
139
if
140
not Protectio.HttpOptions.HttpGet.Enabled and method:find("HttpGet") then
141
if OnAttemptDeny[1] == true then
142
setclipboard(args[1])
143
end
144
145
return makeWarn(
146
string.format(
147
"%s called %s with the URL %s, HttpGet is not enabled and make sure to put the url in the HttpGet.allowedURLs table if you want to trust the url.", gcs(), method, args[1]
148
)
149
)
150
elseif Protectio.HttpOptions.HttpGet.Enabled and method:find("HttpGet") then
151
local url = args[1]
152
local dot = url:split(".")
153
154
if not table.find(Protectio.HttpOptions.HttpGet.allowedURLs, dot[1]) then
155
if OnAttemptDeny[1] == true then
156
setclipboard(url)
157
end
158
return makeWarn(
159
string.format(
160
"%s called %s with the URL %s, Attempt blocked as the URL was not found in the allowed urls table.\n"
161
, gcs(), method, args[1]))
162
else
163
makeMessage(
164
string.format(
165
"%s called %s with URL %s, Attempt success as the URL was found in the allowedURLs table.", gcs(), method, url
166
)
167
)
168
end
169
end
170
171
if
172
not Protectio.HttpOptions.HttpPost.Enabled and method:find("HttpPost") then
173
if OnAttemptDeny[1] == true then
174
setclipboard(args[1])
175
end
176
177
return makeWarn(
178
string.format(
179
"%s called %s with the URL %s, HttpPost is not enabled and make sure to put the url in the HttpPost.allowedURLs table if you want to trust the url.", gcs(), method, args[1]
180
)
181
)
182
elseif Protectio.HttpOptions.HttpPost.Enabled and method:find("HttpPost") then
183
local url = args[1]
184
local dot = url:split(".")
185
186
187
if not table.find(Protectio.HttpOptions.HttpPost.allowedURLs, dot[1]) then
188
if OnAttemptDeny[1] == true then
189
setclipboard(url)
190
end
191
return makeWarn(
192
string.format(
193
"%s called %s with the URL %s, Attempt blocked as the URL was not found in the allowed urls table.\n"
194
, gcs(), method, args[1]))
195
else
196
makeMessage(
197
string.format(
198
"%s called %s with URL %s, Attempt success as the URL was found in the allowedURLs table.", gcs(), method, url
199
)
200
)
201
end
202
end
203
if method == "FireServer" and SMR == nil and not chatMain == nil and getcallingscript() == chatMain then
204
SMR = Self
205
makeMessage(
206
"SayMessageRequest found disguised as "..Self.Name..", Anti Chat Ban should be working as expected now."
207
)
208
209
end
210
if Protectio[3] == false and method == "Kick" and Self == LocalPlayer then
211
return makeWarn(gcs() .. " tried to kick you, Protectio denied the attempt.")
212
end
213
if Protectio[4] == false and method == "ReportAbuse" then
214
if OnAttemptDeny[3] then
215
setclipboard(string.format("-- Latest Report Abuse call info: \nCalling Script: %s\nReason: %s\nPlayer: %s\nNote: %s", gcs(), args[1], args[2], args[3]))
216
end
217
return makeWarn(
218
string.format("-- Latest Report Abuse call info: \nCalling Script: %s\nReason: %s\nPlayer: %s\nNote: %s", gcs(), args[1], args[2], args[3]))
219
end
220
if
221
Protectio[5] == false and method == "CaptureFocus" and not getcallingscript() == chatMain and
222
Self == ChatBar and
223
chat == "legacy"
224
then
225
return makeWarn(gcs() .. " tried to CaptureFocus, Possible Force Chat attempt denied.")
226
elseif chat == "tcs" and method == "CaptureFocus" and Protectio[5] == false then
227
return makeWarn(gcs() .. " tried to call CaptureFocus, Attempt denied.")
228
end
229
if
230
chat == "legacy" and Self == SMR and method == "FireServer" and lastText ~= args[1] and
231
getcallingscript() ~= chatMain
232
then
233
return makeWarn(gcs() .. " tried to call SayMessageRequest")
234
end
235
if Protectio[AllowAccessFriends] == false and method == "GetFriendsAsync" then
236
return makeWarn(string.format("%s tried to call GetFriendsAsync (checking your friend list), Attempt denied"), gcs())
237
end
238
if Protectio.AllowKeyPresses == false and method == "SendKeyEvent" then
239
return makeWarn(string.format("%s tried to call SendKeyEvent on %s, Attempt denied due to AllowKeyPresses being set to false.", gcs(), Self.Name))
240
end
241
return hook(Self, ...)
242
end
243
)
244
if ChatBar ~= nil then
245
ChatBar.Focused:Connect(
246
function()
247
repeat
248
lastText = ChatBar.Text
249
until ChatBar.Text == ""
250
end
251
)
252
end
253
254
hookfunction(
255
error,
256
newcclosure(
257
function(...)
258
if not stopped2 then
259
local args = {...}
260
for i, v in args do
261
makeError = (v)
262
end
263
stopped2 = true
264
for i, v in args do
265
error(v)
266
end
267
stopped2 = false
268
end
269
end
270
)
271
)
272
hookfunction(
273
warn,
274
newcclosure(
275
function(...)
276
if not stopped3 then
277
local args = {...}
278
for i, v in args do
279
makeWarn(v)
280
end
281
stopped3 = true
282
for i, v in args do
283
warn(v)
284
end
285
stopped3 = false
286
end
287
end
288
)
289
)
290
291
if Protectio[AllowKeyPresses] == false then
292
hookfunction(keypress, function(...)
293
local Args = {...}
294
return makeWarn(
295
gcs().. " Tried to keypress with the following kode: "..Args[1])
296
end)
297
end
298
local request = (syn and syn.request or fluxus and fluxus.request)
299
if not Protectio.Request.Enabled then
300
hookfunction(request, function(...)
301
local Args, fullName = {...}, "{ "
302
print(gcs().. "tried to call "..request.." with the following arguements;")
303
for i, Arg in Args do
304
if type(Arg) == "table" then
305
for k, v in Arg do
306
fullName = fullName .. tostring(Arg)
307
if not k == #Args then
308
fullName = fullName..", "
309
end
310
end
311
else
312
313
fullName = fullName .. tostring(Arg)
314
if not i == #Args then
315
fullName = fullName..", "
316
end
317
end
318
end
319
print(fullName.."}")
320
end)
321
end