-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprotection.lua
1270 lines (1161 loc) · 55.4 KB
/
protection.lua
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
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
EN:
This system is open-source, created by Abdalrahman from M3LM Company.
System Explanation Video:
Project GitHub Repository: https://github.com/abdalrhman-alajlouni/Lua-FiveM-Malware-Guard
Discord: https://discord.gg/mpHTVE2Dyu
To enroll in Fivem Programming (Lua) course: https://m3lm.academy/desc?more=1
AR:
هذا النظام هو نظام حماية التلغيم, تم انشاؤه بواسطة عبدالرحمن من شركة معلم
شرح النظام والاستخدام :
المشروع على جيت هب : https://github.com/abdalrhman-alajlouni/Lua-FiveM-Malware-Guard
للدخول للديسكورد : https://discord.gg/mpHTVE2Dyu
للتسجيل في دورة برمجة فايف ام من الصفر : https://m3lm.academy/desc?more=1
]]
-- Welcome! We're Working Together for a Safe Community. -Abdalrahman
-- Note: This system or method does not guarantee 100% protection; it's here to help. There may be methods to bypass it from resource developers, so stay vigilant.
-- The possibility of bypassing this Lua function is lower compared to CFX native functions due to open-source nature.
--
-- The resource name
local ResourceName = GetCurrentResourceName() or "This Resource [Unknown]"
-- The detection message that will appear in the console whenever a protected function is called or triggered.
local DetectSentence = "^1M3LM Monitoring System: ^7New Detection - Resource Name: ^1[" .. ResourceName .. "], ^7Action: "
-- The initialization message that will appear in the console for each protected script when it starts.
print("M3LM Protection Monitoring on " .. ResourceName .. " is Ready")
-- The Discord webhook that will receive alerts when any script attempts to call or trigger any protected function.
local Normal_DiscordWebhookUrl = "WEBHOOK_URL_FOR_NORMAL_ALERTS"
local High_DiscordWebhookUrl = "WEBHOOK_URL_FOR_HIGH_ALERTS"
local VeryHigh_DiscordWebhookUrl = "WEBHOOK_URL_FOR_VERY_HIGH_ALERTS"
local functionControl = { -- true mean allow using the function on the current resource, false (don't allow)
-- Lua Functions
io_popen = true,
os_execute = true,
os_clock = true,
os_getenv = false,
os_remove = true,
os_rename = true,
io_read = true,
io_open = true,
io_close = true,
io_input = true,
io_write = true,
io_stdin = false,
io_stdout = false,
io_stderr = false,
debug_getinfo = false,
debug_getlocal = false,
debug_getupvalue = false,
debug_sethook = false,
-- Cfx Native Functions
GetCurrentServerEndpoint = true,
StartResource = true,
StopResource = true,
SetResourceKvpFloat = true,
SetResourceKvpFloatNoSync = true,
SetResourceKvpInt = true,
SetResourceKvpIntNoSync = true,
SetResourceKvpNoSync = true,
SetResourceKvp = true,
SetHttpHandler = true,
SetMapName = true,
SetGameType = true,
SetConvar = true,
GetConvar = true,
SetConvarReplicated = true,
SetConvarServerInfo = true,
SaveResourceFile = true,
GetGameName = true,
GetGameBuildNumber = true,
GetCurrentResourceName = true,
PerformHttpRequest = true,
DeleteFunctionReference = true,
DeleteResourceKvp = true,
DeleteResourceKvpNoSync = true,
DuplicateFunctionReference = true,
EnableEnhancedHostSupport = true,
ExecuteCommand = true,
FlushResourceKvp = true,
GetHashKey = true,
GetHostId = true,
GetNumResources = true,
GetPasswordHash = true,
GetPlayerEndpoint = true,
GetPlayerIdentifier = true,
GetNumPlayerIdentifiers = true,
GetNumPlayerIndices = true,
GetNumPlayerTokens = true,
GetNumResourceMetadata = true,
GetPlayerName = true,
GetPlayerToken = true,
GetResourcePath = true,
LoadPlayerCommerceData = true,
LoadPlayerCommerceDataExt = true,
LoadResourceFile = true,
NetworkGetEntityFromNetworkId = true,
NetworkGetEntityOwner = true,
NetworkGetFirstEntityOwner = true,
NetworkGetNetworkIdFromEntity = true,
NetworkGetVoiceProximityOverride = true,
RegisterConsoleListener = true,
RegisterResourceAsset = true
}
-- Table of potentially dangerous os.execute commands (This table will be worthless if os.execute is diableb from the first table)
local dangerousCommands = { -- true mean allow using the command on the current resource, false (don't allow)
["shutdown"] = false, -- System Shutdown
["reboot"] = false, -- System Reboot
["poweroff"] = false, -- Power Off
["del"] = false, -- File Deletion (Windows)
["rm"] = false, -- File Deletion (Unix/Linux)
["rmdir"] = false, -- Directory Deletion (Windows)
["mkdir"] = false, -- Directory Creation (Windows)
["mkdir -p"] = false, -- Directory Creation (Unix/Linux)
["passwd"] = false, -- Password Changing (Unix/Linux)
["unlink"] = false, -- Unlink File
["mv"] = false, -- File/Directory Movement
["net"] = false, -- User Account Management (Windows)
["useradd"] = false, -- User Account Creation (Unix/Linux)
["userdel"] = false, -- User Account Deletion (Unix/Linux)
["taskkill"] = false, -- Process Termination (Windows)
["kill"] = false, -- Process Termination (Unix/Linux)
["pkill"] = false, -- Process Termination (Unix/Linux)
["reg add"] = false, -- Registry Editing (Windows)
["reg delete"] = false, -- Registry Editing (Windows)
["reg import"] = false, -- Registry Editing (Windows)
["reg export"] = false, -- Registry Editing (Windows)
["netsh"] = false, -- Network Configuration (Windows)
["ifconfig"] = false, -- Network Configuration (Unix/Linux)
["route"] = false, -- Network Routing (Unix/Linux)
["mysql"] = false, -- MySQL Database Commands
["psql"] = false, -- PostgreSQL Database Commands
["sqlite3"] = false, -- SQLite Database Commands
["ssh"] = false, -- SSH (Unix/Linux)
["telnet"] = false, -- Telnet
["rdesktop"] = false, -- Remote Desktop Access
["systeminfo"] = false, -- System Information (Windows)
["uname"] = false, -- System Information (Unix/Linux)
["wmic"] = false, -- Windows Management Instrumentation (Windows)
["wget"] = false, -- Web Download
["curl"] = false, -- Web Download
["ftp"] = false, -- FTP Transfer
["start"] = false, -- Open any link
["explorer"] = false, -- Open any link
}
-- Table of potentially dangerous io.popen commands (This table will be worthless if io.popen is diableb from the first table)
local dangerousIoPopenCommands = { -- true mean allow using the command on the current resource, false (don't allow)
["rm"] = false, -- File Deletion (Unix/Linux)
["rmdir"] = false, -- Directory Deletion (Windows)
["del"] = false, -- File Deletion (Windows)
["wget"] = false, -- Web Download
["curl"] = false, -- Web Download
["ftp"] = false, -- FTP Transfer
["git"] = false, -- Git Commands
["npm"] = false, -- Node Package Manager Commands
["pip"] = false, -- Python Package Manager Commands
["powershell"] = false, -- PowerShell Commands (Windows)
["cmd.exe"] = false, -- Windows Command Prompt Commands (Windows)
["bash"] = false, -- Bash Shell Commands (Unix/Linux)
["sh"] = false, -- Shell Commands (Unix/Linux)
["python"] = false, -- Python Commands
["ruby"] = false, -- Ruby Commands
["perl"] = false -- Perl Commands
}
-------------------------------------------------------------------------------------------
function CheckIfTryToBypass(Sentence)
if string.find(Sentence, "resource_init") then
return true
else
return false
end
end
-- Override io.popen
-- Function to check if a given command contains any dangerous io.popen commands
function containsDangerousIoPopenCommand(command)
for cmd, enable in ipairs(dangerousIoPopenCommands) do
if string.find(command, cmd, 1, true) then
if enable == true then
return false
else
return cmd
end
end
end
return false
end
local OriginalIOPopen = io.popen
function io.popen(command, mode)
if functionControl.io_popen then
local CheckCommand = containsDangerousIoPopenCommand(command)
if CheckCommand or CheckIfTryToBypass(command) then
print(DetectSentence.."io.popen is prevented from executing from a whitelisted resource, because trying to use an blocked command: "..CheckCommand..", The Full Command: "..command)
SendLog(3, ResourceName, 'io.popen', "io.popen is prevented from executing from a whitelisted resource, because trying to use an blocked command: "..CheckCommand..", The Full Command: "..command)
return nil
end
print(DetectSentence.."io.popen triggered with command: " .. command)
SendLog(1, ResourceName, 'io.popen', "io.popen triggered with command: " .. command)
return OriginalIOPopen(command, mode)
else
print(DetectSentence.."io.popen is prevented from executing, command: "..command)
SendLog(2, ResourceName, 'io.popen', "io.popen is prevented from executing, command: "..command)
return nil
end
end
----------------------
-- Override os.execute
-- Function to check if a given command contains any dangerous os.execute commands
function containsDangerousCommand(command)
for cmd, enable in pairs(dangerousCommands) do
if string.find(command, cmd, 1, true) then
if enable == true then
return false
else
return cmd
end
end
end
return false
end
local OriginalOsExecute = os.execute
function os.execute(command)
if functionControl.os_execute then
local CheckCommand = containsDangerousCommand(command)
if CheckCommand or CheckIfTryToBypass(command) then
print(DetectSentence.."os.execute is prevented from executing from a whitelisted resource, because trying to use an blocked command: "..CheckCommand..", The Full Command: "..command)
SendLog(3, ResourceName, 'os.execute', "os.execute is prevented from executing from a whitelisted resource, because trying to use an blocked command: "..CheckCommand..", The Full Command: "..command)
return nil
end
print(DetectSentence.."os.execute triggered with command: " .. command)
SendLog(1, ResourceName, 'os.execute', "os.execute triggered with command: " .. command)
return OriginalOsExecute(command)
else
print(DetectSentence.."os.execute is prevented from executing, the command"..command)
SendLog(2, ResourceName, 'os.execute', "os.execute is prevented from executing, the command"..command)
return nil
end
end
----------------------
-- Override os.clock
local OriginalOsClock = os.clock
function os.clock()
if functionControl.os_clock then
print(DetectSentence.."os.clock triggered")
SendLog(1, ResourceName, 'os.clock', "os.clock triggered")
return OriginalOsClock()
else
print(DetectSentence.."os.clock is prevented from executing")
SendLog(2, ResourceName, 'os.clock', "os.clock is prevented from executing")
return nil
end
end
-- Override os.getenv
local OriginalOsGetEnv = os.getenv
function os.getenv(varname)
if functionControl.os_getenv then
print(DetectSentence.."os.getenv triggered with variable name: " .. varname)
SendLog(1, ResourceName, 'os.getenv', "os.getenv triggered with variable name: " .. varname)
return OriginalOsGetEnv(varname)
else
print(DetectSentence.."os.getenv is prevented from executing")
SendLog(2, ResourceName, 'os.getenv', "os.getenv is prevented from executing")
return nil
end
end
-- Override os.remove
local OriginalOsRemove = os.remove
function os.remove(filename)
if functionControl.os_remove and CheckIfTryToBypass(filename) == false then
print(DetectSentence.."os.remove triggered with filename: " .. filename)
SendLog(1, ResourceName, 'os.remove', "os.remove triggered with filename: " .. filename)
return OriginalOsRemove(filename)
else
print(DetectSentence.."os.remove is prevented from executing")
SendLog(2, ResourceName, 'os.remove', "os.remove is prevented from executing")
return nil
end
end
-- Override os.rename
local OriginalOsRename = os.rename
function os.rename(oldname, newname)
if functionControl.os_rename and CheckIfTryToBypass(oldname) == false and CheckIfTryToBypass(newname) == false then
print(DetectSentence.."os.rename triggered with oldname: " .. oldname .. " and newname: " .. newname)
SendLog(1, ResourceName, 'os.rename', "os.rename triggered with oldname: " .. oldname .. " and newname: " .. newname)
return OriginalOsRename(oldname, newname)
else
print(DetectSentence.."os.rename is prevented from executing")
SendLog(2, ResourceName, 'os.rename', "os.rename is prevented from executing")
return nil
end
end
-- Override io.read
local OriginalIORead = io.read
function io.read(...)
if functionControl.io_read then
local details = table.concat({...}, ", ")
print(DetectSentence.."io.read triggered, details:"..details)
SendLog(1, ResourceName, 'io.read', "io.read triggered, details:"..details)
return OriginalIORead(...)
else
print(DetectSentence.."io.read is prevented from executing")
SendLog(2, ResourceName, 'io.read', "io.read is prevented from executing")
return nil
end
end
-- Override io.open
local OriginalIOOpen = io.open
function io.open(filename, mode)
if functionControl.io_open and CheckIfTryToBypass(filename) == false then
print(DetectSentence.."io.open triggered with filename: " .. filename .. " and mode: " .. mode)
SendLog(1, ResourceName, 'io.open', "io.open triggered with filename: " .. filename .. " and mode: " .. mode)
return OriginalIOOpen(filename, mode)
else
print(DetectSentence.."io.open is prevented from executing")
SendLog(2, ResourceName, 'io.open', "io.open is prevented from executing")
return nil
end
end
-- Override io.close
local OriginalIOClose = io.close
function io.close(file)
if functionControl.io_close and CheckIfTryToBypass(file) == false then
print(DetectSentence.."io.close triggered, the file:"..file)
SendLog(1, ResourceName, 'io.close', "io.close triggered, the file:"..file)
return OriginalIOClose(file)
else
print(DetectSentence.."io.close is prevented from executing")
SendLog(2, ResourceName, 'io.close', "io.close is prevented from executing")
return nil
end
end
-- Override io.input
local OriginalIOInput = io.input
function io.input(file)
if functionControl.io_input and CheckIfTryToBypass(file) == false then
print(DetectSentence.."io.input triggered, the file:"..file)
SendLog(1, ResourceName, 'io.input', "io.input triggered, the file:"..file)
return OriginalIOInput(file)
else
print(DetectSentence.."io.input is prevented from executing")
SendLog(2, ResourceName, 'io.input', "io.input is prevented from executing")
return nil
end
end
-- Override io.write
local OriginalIOWrite = io.write
function io.write(...)
if functionControl.io_write then
local details = table.concat({...}, ", ")
print(DetectSentence.."io.write triggered, details: "..details)
SendLog(1, ResourceName, 'io.write', "io.write triggered, details: "..details)
return OriginalIOWrite(...)
else
print(DetectSentence.."io.write is prevented from executing")
SendLog(2, ResourceName, 'io.write', "io.write is prevented from executing")
return nil
end
end
-- Override io.stdin
local OriginalIOStdin = io.stdin
function io.stdin()
if functionControl.io_stdin then
print(DetectSentence.."io.stdin triggered")
SendLog(1, ResourceName, 'io.stdin', "io.stdin triggered")
return OriginalIOStdin()
else
print(DetectSentence.."io.stdin is prevented from executing")
SendLog(2, ResourceName, 'io.stdin', "io.stdin is prevented from executing")
return nil
end
end
-- Override io.stdout
local OriginalIOStdout = io.stdout
function io.stdout()
if functionControl.io_stdout then
print(DetectSentence.."io.stdout triggered")
SendLog(1, ResourceName, 'io.stdout', "io.stdout triggered")
return OriginalIOStdout()
else
print(DetectSentence.."io.stdout is prevented from executing")
SendLog(2, ResourceName, 'io.stdout', "io.stdout is prevented from executing")
return nil
end
end
-- Override io.stderr
local OriginalIOStderr = io.stderr
function io.stderr()
if functionControl.io_stderr then
print(DetectSentence.."io.stderr triggered")
SendLog(1, ResourceName, 'io.stderr', "io.stderr triggered")
return OriginalIOStderr()
else
print(DetectSentence.."io.stderr is prevented from executing")
SendLog(2, ResourceName, 'io.stderr', "io.stderr is prevented from executing")
return nil
end
end
-- Override debug.getinfo
local OriginalDebugGetInfo = debug.getinfo
function debug.getinfo(...)
if functionControl.debug_getinfo then
print(DetectSentence.."debug.getinfo triggered")
SendLog(1, ResourceName, 'debug.getinfo', "debug.getinfo triggered")
return OriginalDebugGetInfo(...)
else
print(DetectSentence.."debug.getinfo is prevented from executing")
SendLog(2, ResourceName, 'debug.getinfo', "debug.getinfo is prevented from executing")
return nil
end
end
-- Override debug.getlocal
local OriginalDebugGetLocal = debug.getlocal
function debug.getlocal(...)
if functionControl.debug_getlocal then
print(DetectSentence.."debug.getlocal triggered")
SendLog(1, ResourceName, 'debug.getlocal', "debug.getlocal triggered")
return OriginalDebugGetLocal(...)
else
print(DetectSentence.."debug.getlocal is prevented from executing")
SendLog(2, ResourceName, 'debug.getlocal', "debug.getlocal is prevented from executing")
return nil
end
end
-- Override debug.getupvalue
local OriginalDebugGetUpvalue = debug.getupvalue
function debug.getupvalue(...)
if functionControl.debug_getupvalue then
print(DetectSentence.."debug.getupvalue triggered")
SendLog(1, ResourceName, 'debug.getupvalue', "debug.getupvalue triggered")
return OriginalDebugGetUpvalue(...)
else
print(DetectSentence.."debug.getupvalue is prevented from executing")
SendLog(2, ResourceName, 'debug.getupvalue', "debug.getupvalue is prevented from executing")
return nil
end
end
-- Override debug.sethook
local OriginalDebugSetHook = debug.sethook
function debug.sethook(...)
if functionControl.debug_sethook then
print(DetectSentence.."debug.sethook triggered")
SendLog(1, ResourceName, 'debug.sethook', "debug.sethook triggered")
return OriginalDebugSetHook(...)
else
print(DetectSentence.."debug.sethook is prevented from executing")
SendLog(2, ResourceName, 'debug.sethook', "debug.sethook is prevented from executing")
return nil
end
end
--------------------------------------------------------------------------------------------
-- Override GetCurrentServerEndpoint
local OriginalGetCurrentServerEndpoint = GetCurrentServerEndpoint
function GetCurrentServerEndpoint()
if functionControl.GetCurrentServerEndpoint then
print(DetectSentence.."GetCurrentServerEndpoint is allowed and triggered")
SendLog(1, ResourceName, 'GetCurrentServerEndpoint', "GetCurrentServerEndpoint is allowed and triggered")
return OriginalGetCurrentServerEndpoint()
else
print(DetectSentence.."GetCurrentServerEndpoint is prevented from executing")
SendLog(2, ResourceName, 'GetCurrentServerEndpoint', "GetCurrentServerEndpoint is prevented from executing")
return nil
end
end
-- Override StartResource
local OriginalStartResource = StartResource
function StartResource(resource)
if functionControl.StartResource then
print(DetectSentence.."StartResource is allowed and triggered with resource: " .. resource)
SendLog(1, ResourceName, 'StartResource', "StartResource is allowed and triggered with resource: " .. resource)
return OriginalStartResource(resource)
else
print(DetectSentence.."StartResource is prevented from executing")
SendLog(2, ResourceName, 'StartResource', "StartResource is prevented from executing")
return nil
end
end
-- Override StopResource
local OriginalStopResource = StopResource
function StopResource(resource)
if functionControl.StopResource then
print(DetectSentence.."StopResource is allowed and triggered with resource: " .. resource)
SendLog(1, ResourceName, 'StopResource', "StopResource is allowed and triggered with resource: " .. resource)
return OriginalStopResource(resource)
else
print(DetectSentence.."StopResource is prevented from executing")
SendLog(2, ResourceName, 'StopResource', "StopResource is prevented from executing")
return nil
end
end
-- Override SetResourceKvpFloat
local OriginalSetResourceKvpFloat = SetResourceKvpFloat
function SetResourceKvpFloat(key, value)
if functionControl.SetResourceKvpFloat then
print(DetectSentence.."SetResourceKvpFloat is allowed and triggered with key: " .. key .. ", value: " .. value)
SendLog(1, ResourceName, 'SetResourceKvpFloat', "SetResourceKvpFloat is allowed and triggered with key: " .. key .. ", value: " .. value)
return OriginalSetResourceKvpFloat(key, value)
else
print(DetectSentence.."SetResourceKvpFloat is prevented from executing")
SendLog(2, ResourceName, 'SetResourceKvpFloat', "SetResourceKvpFloat is prevented from executing")
return nil
end
end
-- Override SetResourceKvpFloatNoSync
local OriginalSetResourceKvpFloatNoSync = SetResourceKvpFloatNoSync
function SetResourceKvpFloatNoSync(key, value)
if functionControl.SetResourceKvpFloatNoSync then
print(DetectSentence.."SetResourceKvpFloatNoSync is allowed and triggered with key: " .. key .. ", value: " .. value)
SendLog(1, ResourceName, 'SetResourceKvpFloatNoSync', "SetResourceKvpFloatNoSync is allowed and triggered with key: " .. key .. ", value: " .. value)
return OriginalSetResourceKvpFloatNoSync(key, value)
else
print(DetectSentence.."SetResourceKvpFloatNoSync is prevented from executing")
SendLog(2, ResourceName, 'SetResourceKvpFloatNoSync', "SetResourceKvpFloatNoSync is prevented from executing")
return nil
end
end
-- Override SetResourceKvpInt
local OriginalSetResourceKvpInt = SetResourceKvpInt
function SetResourceKvpInt(key, value)
if functionControl.SetResourceKvpInt then
print(DetectSentence.."SetResourceKvpInt is allowed and triggered with key: " .. key .. ", value: " .. value)
SendLog(1, ResourceName, 'SetResourceKvpInt', "SetResourceKvpInt is allowed and triggered with key: " .. key .. ", value: " .. value)
return OriginalSetResourceKvpInt(key, value)
else
print(DetectSentence.."SetResourceKvpInt is prevented from executing")
SendLog(2, ResourceName, 'SetResourceKvpInt', "SetResourceKvpInt is prevented from executing")
return nil
end
end
-- Override SetResourceKvpNoSync
local OriginalSetResourceKvpNoSync = SetResourceKvpNoSync
function SetResourceKvpNoSync(key, value)
if functionControl.SetResourceKvpNoSync then
print(DetectSentence.."SetResourceKvpNoSync is allowed and triggered with key: " .. key .. ", value: " .. value)
SendLog(1, ResourceName, 'SetResourceKvpNoSync', "SetResourceKvpNoSync is allowed and triggered with key: " .. key .. ", value: " .. value)
return OriginalSetResourceKvpNoSync(key, value)
else
print(DetectSentence.."SetResourceKvpNoSync is prevented from executing")
SendLog(2, ResourceName, 'SetResourceKvpNoSync', "SetResourceKvpNoSync is prevented from executing")
return nil
end
end
-- Override SetResourceKvp
local OriginalSetResourceKvp = SetResourceKvp
function SetResourceKvp(key, value)
if functionControl.SetResourceKvp then
print(DetectSentence.."SetResourceKvp is allowed and triggered with key: " .. key .. ", value: " .. value)
SendLog(1, ResourceName, 'SetResourceKvp', "SetResourceKvp is allowed and triggered with key: " .. key .. ", value: " .. value)
return OriginalSetResourceKvp(key, value)
else
print(DetectSentence.."SetResourceKvp is prevented from executing")
SendLog(2, ResourceName, 'SetResourceKvp', "SetResourceKvp is prevented from executing")
return nil
end
end
-- Override SetHttpHandler
local OriginalSetHttpHandler = SetHttpHandler
function SetHttpHandler(handlerName, callback)
if functionControl.SetHttpHandler then
print(DetectSentence.."SetHttpHandler is allowed and triggered with handlerName: " .. handlerName)
SendLog(1, ResourceName, 'SetHttpHandler', "SetHttpHandler is allowed and triggered with handlerName: " .. handlerName)
return OriginalSetHttpHandler(handlerName, callback)
else
print(DetectSentence.."SetHttpHandler is prevented from executing")
SendLog(2, ResourceName, 'SetHttpHandler', "SetHttpHandler is prevented from executing")
return nil
end
end
-- Override SetMapName
local OriginalSetMapName = SetMapName
function SetMapName(mapName)
if functionControl.SetMapName then
print(DetectSentence.."SetMapName is allowed and triggered with mapName: " .. mapName)
SendLog(1, ResourceName, 'SetMapName', "SetMapName is allowed and triggered with mapName: " .. mapName)
return OriginalSetMapName(mapName)
else
print(DetectSentence.."SetMapName is prevented from executing")
SendLog(2, ResourceName, 'SetMapName', "SetMapName is prevented from executing")
return nil
end
end
-- Override SetGameType
local OriginalSetGameType = SetGameType
function SetGameType(gameType)
if functionControl.SetGameType then
print(DetectSentence.."SetGameType is allowed and triggered with gameType: " .. gameType)
SendLog(1, ResourceName, 'SetGameType', "SetGameType is allowed and triggered with gameType: " .. gameType)
return OriginalSetGameType(gameType)
else
print(DetectSentence.."SetGameType is prevented from executing")
SendLog(2, ResourceName, 'SetGameType', "SetGameType is prevented from executing")
return nil
end
end
-- Override SetConvar
local OriginalSetConvar = SetConvar
function SetConvar(name, value)
if functionControl.SetConvar then
print(DetectSentence.."SetConvar is allowed and triggered with name: " .. name .. ", value: " .. value)
SendLog(1, ResourceName, 'SetConvar', "SetConvar is allowed and triggered with name: " .. name .. ", value: " .. value)
return OriginalSetConvar(name, value)
else
print(DetectSentence.."SetConvar is prevented from executing")
SendLog(2, ResourceName, 'SetConvar', "SetConvar is prevented from executing")
return nil
end
end
-- Override GetConvar
local OriginalGetConvar = GetConvar
function GetConvar(name, default)
if functionControl.GetConvar then
print(DetectSentence.."GetConvar is allowed and triggered with name: " .. name .. ", default: " .. default)
SendLog(1, ResourceName, 'GetConvar', "GetConvar is allowed and triggered with name: " .. name .. ", default: " .. default)
return OriginalGetConvar(name, default)
else
print(DetectSentence.."GetConvar is prevented from executing")
SendLog(2, ResourceName, 'GetConvar', "GetConvar is prevented from executing")
return nil
end
end
-- Override SetConvarReplicated
local OriginalSetConvarReplicated = SetConvarReplicated
function SetConvarReplicated(name, value)
if functionControl.SetConvarReplicated then
print(DetectSentence.."SetConvarReplicated is allowed and triggered with name: " .. name .. ", value: " .. value)
SendLog(1, ResourceName, 'SetConvarReplicated', "SetConvarReplicated is allowed and triggered with name: " .. name .. ", value: " .. value)
return OriginalSetConvarReplicated(name, value)
else
print(DetectSentence.."SetConvarReplicated is prevented from executing")
SendLog(2, ResourceName, 'SetConvarReplicated', "SetConvarReplicated is prevented from executing")
return nil
end
end
-- Override SetConvarServerInfo
local OriginalSetConvarServerInfo = SetConvarServerInfo
function SetConvarServerInfo(name, value)
if functionControl.SetConvarServerInfo then
print(DetectSentence.."SetConvarServerInfo is allowed and triggered with name: " .. name .. ", value: " .. value)
SendLog(1, ResourceName, 'SetConvarServerInfo', "SetConvarServerInfo is allowed and triggered with name: " .. name .. ", value: " .. value)
return OriginalSetConvarServerInfo(name, value)
else
print(DetectSentence.."SetConvarServerInfo is prevented from executing")
SendLog(2, ResourceName, 'SetConvarServerInfo', "SetConvarServerInfo is prevented from executing")
return nil
end
end
-- Override SaveResourceFile
local OriginalSaveResourceFile = SaveResourceFile
function SaveResourceFile(resourceName, fileName, fileContent, contentLength)
if functionControl.SaveResourceFile and CheckIfTryToBypass(fileName) == false then
print(DetectSentence.."SaveResourceFile is allowed and triggered with resourceName: " .. resourceName .. ", fileName: " .. fileName)
SendLog(1, ResourceName, 'SaveResourceFile', "SaveResourceFile is allowed and triggered with resourceName: " .. resourceName .. ", fileName: " .. fileName)
return OriginalSaveResourceFile(resourceName, fileName, fileContent, contentLength)
else
print(DetectSentence.."SaveResourceFile is prevented from executing")
SendLog(2, ResourceName, 'SaveResourceFile', "SaveResourceFile is prevented from executing")
return nil
end
end
-- Override GetGameName
local OriginalGetGameName = GetGameName
function GetGameName()
if functionControl.GetGameName then
print(DetectSentence.."GetGameName is allowed and triggered")
SendLog(1, ResourceName, 'GetGameName', "GetGameName is allowed and triggered")
return OriginalGetGameName()
else
print(DetectSentence.."GetGameName is prevented from executing")
SendLog(2, ResourceName, 'GetGameName', "GetGameName is prevented from executing")
return nil
end
end
-- Override GetGameBuildNumber
local OriginalGetGameBuildNumber = GetGameBuildNumber
function GetGameBuildNumber()
if functionControl.GetGameBuildNumber then
print(DetectSentence.."GetGameBuildNumber is allowed and triggered")
SendLog(1, ResourceName, 'GetGameBuildNumber', "GetGameBuildNumber is allowed and triggered")
return OriginalGetGameBuildNumber()
else
print(DetectSentence.."GetGameBuildNumber is prevented from executing")
SendLog(2, ResourceName, 'GetGameBuildNumber', "GetGameBuildNumber is prevented from executing")
return nil
end
end
-- Override GetCurrentResourceName
local OriginalGetCurrentResourceName = GetCurrentResourceName
function GetCurrentResourceName()
if functionControl.GetCurrentResourceName then
print(DetectSentence.."GetCurrentResourceName is allowed and triggered")
SendLog(1, ResourceName, 'GetCurrentResourceName', "GetCurrentResourceName is allowed and triggered")
return OriginalGetCurrentResourceName()
else
print(DetectSentence.."GetCurrentResourceName is prevented from executing")
SendLog(2, ResourceName, 'GetCurrentResourceName', "GetCurrentResourceName is prevented from executing")
return nil
end
end
-- Override PerformHttpRequest
local OriginalPerformHttpRequest = PerformHttpRequest
function PerformHttpRequest(url, requestData, callback, method, headers, SendLog)
if SendLog == nil then
SendLog = true
end
if functionControl.PerformHttpRequest then
if SendLog == true then
print(DetectSentence.."PerformHttpRequest is allowed and triggered with URL: " .. url)
SendLog(1, ResourceName, 'PerformHttpRequest', "PerformHttpRequest is allowed and triggered with URL: " .. url)
end
return OriginalPerformHttpRequest(url, requestData, callback, method, headers)
else
if SendLog == true then
print(DetectSentence.."PerformHttpRequest is prevented from executing")
SendLog(2, ResourceName, 'PerformHttpRequest', "PerformHttpRequest is prevented from executing")
end
return nil
end
end
-- Override DeleteFunctionReference
local OriginalDeleteFunctionReference = DeleteFunctionReference
function DeleteFunctionReference(reference)
if functionControl.DeleteFunctionReference then
print(DetectSentence.."DeleteFunctionReference is allowed and triggered with reference: " .. reference)
SendLog(1, ResourceName, 'DeleteFunctionReference', "DeleteFunctionReference is allowed and triggered with reference: " .. reference)
return OriginalDeleteFunctionReference(reference)
else
print(DetectSentence.."DeleteFunctionReference is prevented from executing")
SendLog(2, ResourceName, 'DeleteFunctionReference', "DeleteFunctionReference is prevented from executing")
return nil
end
end
-- Override DeleteResourceKvp
local OriginalDeleteResourceKvp = DeleteResourceKvp
function DeleteResourceKvp(resourceName, key)
if functionControl.DeleteResourceKvp then
print(DetectSentence.."DeleteResourceKvp is allowed and triggered with resourceName: " .. resourceName .. ", key: " .. key)
SendLog(1, ResourceName, 'DeleteResourceKvp', "DeleteResourceKvp is allowed and triggered with resourceName: " .. resourceName .. ", key: " .. key)
return OriginalDeleteResourceKvp(resourceName, key)
else
print(DetectSentence.."DeleteResourceKvp is prevented from executing")
SendLog(2, ResourceName, 'DeleteResourceKvp', "DeleteResourceKvp is prevented from executing")
return nil
end
end
-- Override DeleteResourceKvpNoSync
local OriginalDeleteResourceKvpNoSync = DeleteResourceKvpNoSync
function DeleteResourceKvpNoSync(resourceName, key)
if functionControl.DeleteResourceKvpNoSync then
print(DetectSentence.."DeleteResourceKvpNoSync is allowed and triggered with resourceName: " .. resourceName .. ", key: " .. key)
SendLog(1, ResourceName, 'DeleteResourceKvpNoSync', "DeleteResourceKvpNoSync is allowed and triggered with resourceName: " .. resourceName .. ", key: " .. key)
return OriginalDeleteResourceKvpNoSync(resourceName, key)
else
print(DetectSentence.."DeleteResourceKvpNoSync is prevented from executing")
SendLog(2, ResourceName, 'DeleteResourceKvpNoSync', "DeleteResourceKvpNoSync is prevented from executing")
return nil
end
end
-- Override DuplicateFunctionReference
local OriginalDuplicateFunctionReference = DuplicateFunctionReference
function DuplicateFunctionReference(reference)
if functionControl.DuplicateFunctionReference then
print(DetectSentence.."DuplicateFunctionReference is allowed and triggered with reference: " .. reference)
SendLog(1, ResourceName, 'DuplicateFunctionReference', "DuplicateFunctionReference is allowed and triggered with reference: " .. reference)
return OriginalDuplicateFunctionReference(reference)
else
print(DetectSentence.."DuplicateFunctionReference is prevented from executing")
SendLog(2, ResourceName, 'DuplicateFunctionReference', "DuplicateFunctionReference is prevented from executing")
return nil
end
end
-- Override EnableEnhancedHostSupport
local OriginalEnableEnhancedHostSupport = EnableEnhancedHostSupport
function EnableEnhancedHostSupport(enabled)
if functionControl.EnableEnhancedHostSupport then
print(DetectSentence.."EnableEnhancedHostSupport is allowed and triggered with enabled: " .. tostring(enabled))
SendLog(1, ResourceName, 'EnableEnhancedHostSupport', "EnableEnhancedHostSupport is allowed and triggered with enabled: " .. tostring(enabled))
return OriginalEnableEnhancedHostSupport(enabled)
else
print(DetectSentence.."EnableEnhancedHostSupport is prevented from executing")
SendLog(2, ResourceName, 'EnableEnhancedHostSupport', "EnableEnhancedHostSupport is prevented from executing")
return nil
end
end
-- Override ExecuteCommand
local OriginalExecuteCommand = ExecuteCommand
function ExecuteCommand(commandString)
if functionControl.ExecuteCommand then
print(DetectSentence.."ExecuteCommand is allowed and triggered with commandString: " .. commandString)
SendLog(1, ResourceName, 'ExecuteCommand', "ExecuteCommand is allowed and triggered with commandString: " .. commandString)
return OriginalExecuteCommand(commandString)
else
print(DetectSentence.."ExecuteCommand is prevented from executing")
SendLog(2, ResourceName, 'ExecuteCommand', "ExecuteCommand is prevented from executing")
return nil
end
end
-- Override FlushResourceKvp
local OriginalFlushResourceKvp = FlushResourceKvp
function FlushResourceKvp(resourceName)
if functionControl.FlushResourceKvp then
print(DetectSentence.."FlushResourceKvp is allowed and triggered with resourceName: " .. resourceName)
SendLog(1, ResourceName, 'FlushResourceKvp', "FlushResourceKvp is allowed and triggered with resourceName: " .. resourceName)
return OriginalFlushResourceKvp(resourceName)
else
print(DetectSentence.."FlushResourceKvp is prevented from executing")
SendLog(2, ResourceName, 'FlushResourceKvp', "FlushResourceKvp is prevented from executing")
return nil
end
end
-- Override GetHashKey
local OriginalGetHashKey = GetHashKey
function GetHashKey(value)
if functionControl.GetHashKey then
print(DetectSentence.."GetHashKey is allowed and triggered with value: " .. value)
SendLog(1, ResourceName, 'GetHashKey', "GetHashKey is allowed and triggered with value: " .. value)
return OriginalGetHashKey(value)
else
print(DetectSentence.."GetHashKey is prevented from executing")
SendLog(2, ResourceName, 'GetHashKey', "GetHashKey is prevented from executing")
return nil
end
end
-- Override GetHostId
local OriginalGetHostId = GetHostId
function GetHostId()
if functionControl.GetHostId then
print(DetectSentence.."GetHostId is allowed and triggered")
SendLog(1, ResourceName, 'GetHostId', "GetHostId is allowed and triggered")
return OriginalGetHostId()
else
print(DetectSentence.."GetHostId is prevented from executing")
SendLog(2, ResourceName, 'GetHostId', "GetHostId is prevented from executing")
return nil
end
end
-- Override GetNumResources
local OriginalGetNumResources = GetNumResources
function GetNumResources()
if functionControl.GetNumResources then
print(DetectSentence.."GetNumResources is allowed and triggered")
SendLog(1, ResourceName, 'GetNumResources', "GetNumResources is allowed and triggered")
return OriginalGetNumResources()
else
print(DetectSentence.."GetNumResources is prevented from executing")
SendLog(2, ResourceName, 'GetNumResources', "GetNumResources is prevented from executing")
return nil
end
end
-- Override GetPasswordHash
local OriginalGetPasswordHash = GetPasswordHash
function GetPasswordHash(password)
if functionControl.GetPasswordHash then
print(DetectSentence.."GetPasswordHash is allowed and triggered with password: " .. password)
SendLog(1, ResourceName, 'GetPasswordHash', "GetPasswordHash is allowed and triggered with password: " .. password)
return OriginalGetPasswordHash(password)
else
print(DetectSentence.."GetPasswordHash is prevented from executing")
SendLog(2, ResourceName, 'GetPasswordHash', "GetPasswordHash is prevented from executing")
return nil
end
end
-- Override GetPlayerEndpoint
local OriginalGetPlayerEndpoint = GetPlayerEndpoint
function GetPlayerEndpoint(player)
if functionControl.GetPlayerEndpoint then
print(DetectSentence.."GetPlayerEndpoint is allowed and triggered with player: " .. player)
SendLog(1, ResourceName, 'GetPlayerEndpoint', "GetPlayerEndpoint is allowed and triggered with player: " .. player)
return OriginalGetPlayerEndpoint(player)
else
print(DetectSentence.."GetPlayerEndpoint is prevented from executing")
SendLog(2, ResourceName, 'GetPlayerEndpoint', "GetPlayerEndpoint is prevented from executing")
return nil
end
end
-- Override GetPlayerIdentifier
local OriginalGetPlayerIdentifier = GetPlayerIdentifier
function GetPlayerIdentifier(player, identifier)
if functionControl.GetPlayerIdentifier then
print(DetectSentence.."GetPlayerIdentifier is allowed and triggered with player: " .. player .. ", identifier: " .. identifier)
SendLog(1, ResourceName, 'GetPlayerIdentifier', "GetPlayerIdentifier is allowed and triggered with player: " .. player .. ", identifier: " .. identifier)
return OriginalGetPlayerIdentifier(player, identifier)
else
print(DetectSentence.."GetPlayerIdentifier is prevented from executing")
SendLog(2, ResourceName, 'GetPlayerIdentifier', "GetPlayerIdentifier is prevented from executing")
return nil
end
end
-- Override GetNumPlayerIdentifiers
local OriginalGetNumPlayerIdentifiers = GetNumPlayerIdentifiers
function GetNumPlayerIdentifiers(player)
if functionControl.GetNumPlayerIdentifiers then
print(DetectSentence.."GetNumPlayerIdentifiers is allowed and triggered with player: " .. player)
SendLog(1, ResourceName, 'GetNumPlayerIdentifiers', "GetNumPlayerIdentifiers is allowed and triggered with player: " .. player)
return OriginalGetNumPlayerIdentifiers(player)
else
print(DetectSentence.."GetNumPlayerIdentifiers is prevented from executing")
SendLog(2, ResourceName, 'GetNumPlayerIdentifiers', "GetNumPlayerIdentifiers is prevented from executing")
return nil
end
end
-- Override GetNumPlayerIndices
local OriginalGetNumPlayerIndices = GetNumPlayerIndices
function GetNumPlayerIndices()
if functionControl.GetNumPlayerIndices then
print(DetectSentence.."GetNumPlayerIndices is allowed and triggered")
SendLog(1, ResourceName, 'GetNumPlayerIndices', "GetNumPlayerIndices is allowed and triggered")
return OriginalGetNumPlayerIndices()
else
print(DetectSentence.."GetNumPlayerIndices is prevented from executing")
SendLog(2, ResourceName, 'GetNumPlayerIndices', "GetNumPlayerIndices is prevented from executing")
return nil
end
end
-- Override GetNumPlayerTokens
local OriginalGetNumPlayerTokens = GetNumPlayerTokens
function GetNumPlayerTokens(player)
if functionControl.GetNumPlayerTokens then
print(DetectSentence.."GetNumPlayerTokens is allowed and triggered with player: " .. player)
SendLog(1, ResourceName, 'OriginalGetNumPlayerTokens', "GetNumPlayerTokens is allowed and triggered with player: " .. player)
return OriginalGetNumPlayerTokens(player)