Advertisement
ERROR_CODE

Protector

Jan 10th, 2024 (edited)
1,434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.03 KB | None | 0 0
  1. local options={
  2.     MaliciousNamecalls={
  3.         Enabled=true,
  4.         ShowNamecall=true
  5.     },
  6.     ChatBan={
  7.         Enabled=true,
  8.         Slash=true,
  9.     NewChat=true
  10.     },
  11.     PetSim={
  12.         Enabled=true,
  13.         ShowUser=true,
  14.         Bank=true,
  15.         Mail=true
  16.     },
  17.     MiningSim=true,
  18.     AntiLog={
  19.         Enabled=true,
  20.         ShowInfo=true,
  21.         ShowDestination=true,
  22.         Payback=true
  23.     },
  24.     AutoJoin={
  25.         Enabled=true,
  26.         ShowServer=true
  27.     },
  28.     BeeSwarm=true,
  29.     Require=true,
  30.     AntiKick=true,
  31.     BasicAntiCheatBypass=true,
  32.     MemoryDetections=true,
  33.     GUIDetection=true,
  34.     GroupBypass=true,
  35.     ClearTrace=true,
  36.     Error=true,
  37.     Message=true,
  38.     AntiIdle=true,
  39.     AntiApi={
  40.     Enabled=true,
  41.     ShowEndpoint=true
  42.     },
  43.     Output=warn
  44. }
  45. local Guardian={
  46.     SetAll=function(a)
  47.         for i, v in next,options do
  48.             if typeof(v)=="table" then
  49.                 for i2 in next,v do
  50.                     options[i][i2]=a
  51.                 end
  52.             else
  53.                 options[i]=a
  54.             end
  55.         end
  56.     end
  57. }
  58. game:GetService("StarterGui"):SetCore("SendNotification",{
  59.     Title="Script Blox Protection Activated",
  60.     Text="Note: Use Verified Scripts",
  61.     Button1="Okay!",
  62.     Duration=8
  63. })
  64.  
  65. if not hookmetamethod or not hookfunction then
  66.     task.spawn(function()error("Your executor does not support a core function needed for this script. Expect detections and poor security")end)
  67. end
  68. if not getproperties then
  69.     task.spawn(function()error("Your executor does not support getproperties, so the basic anti cheat bypass sadly won't work for you. However, everything else should.")end)
  70. end
  71. local hrequest,execlosure=
  72. {
  73.     (typeof(syn)=='table'and syn.request),
  74.     (typeof(http)=='table'and http.request),
  75.     (typeof(fluxus)=='table'and fluxus.request),
  76.     request,
  77.     http_request~=request and http_request,
  78.     HttpPost
  79. },is_synapse_function or isexecutorclosure or iskrnlclosure or issentinelclosure or is_protosmasher_closure or is_sirhurt_closure or iselectronfunction or checkclosure
  80. local savedProps={}
  81. local Players=game:GetService("Players")
  82. local LocalPlayer=Players.LocalPlayer
  83. local Char=(LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait())
  84. local rd=math.random
  85. local strFind=clonefunction(string.find)
  86. local strMatch=clonefunction(string.match)
  87. local StarterGui,Stats,Content=game:GetService("StarterGui"),game:GetService("Stats"),game:GetService("ContentProvider")
  88. local tr,hiv,bank=game.PlaceId==9551640993 and game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("ConfirmTrade"),game.PlaceId==1537690962 and game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("ConstructHiveCellFromEgg")--[[game.PlaceId==6284583030 and workspace:WaitForChild("__THINGS"):WaitForChild("__REMOTES"):WaitForChild("invite to bank")]]
  89. local ChatBar,ChatScript,SayMessageRequest
  90. if game:GetService("TextChatService").ChatVersion == Enum.ChatVersion.LegacyChatService then
  91.     ChatBar = LocalPlayer.PlayerGui:WaitForChild("Chat"):WaitForChild("Frame").ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar
  92. end
  93. ChatScript = LocalPlayer.PlayerScripts:WaitForChild("ChatScript")
  94. SayMessageRequest = game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest
  95. local ChatMain=ChatScript:WaitForChild("ChatMain")
  96. local MessagePostedEvent
  97. for _, Event in next, debug.getupvalues(require(ChatMain).MessagePosted.fire) do
  98.     if typeof(Event) == "Instance" then
  99.         MessagePostedEvent = Event
  100.     end
  101. end
  102. local namecall={
  103.     ["BrowserService"]={
  104.         ["OpenBrowserWindow"]=1,
  105.         ["ExecuteJavaScript"]=2,
  106.     ["SendCommand"]=3,
  107.     ["OpenNativeOverlay"]=4,
  108.     ["CloseBrowserWindow"]=5,
  109.     ["OpenWeChatAuthWindow"]=6
  110.     },
  111.     ["MarketplaceService"]={
  112.         ["PerformPurchase"]=nil,
  113.     ["PerformPurchaseV2"]=nil,
  114.         ["GetRobuxBalance"]=0,
  115.     ["PromptGamePassPurchase"]=nil,
  116.     ["PromptPurchase"]=nil,
  117.     ["PromptBundlePurchase"]=nil,
  118.     ["PromptProductPurchase"]=nil,
  119.     ["PromptSubscriptionPurchase"]=nil
  120.     },
  121.     ["MessageBusService"]={
  122.         ["Publish"]=1,
  123.         ["GetMessageId"]=2
  124.     },
  125.     ["HttpService"]={
  126.         ["RequestInternal"]=1
  127.     },
  128.     ["GuiService"]={
  129.         ["OpenBrowserWindow"]=1,
  130.     ["OpenNativeOverlay"]=2,
  131.     ["SetPurchasePromptIsShown"]=3
  132.     },
  133.     ["DataModel"]={
  134.         ["OpenVideosFolder"]=1,
  135.         ["OpenScreenshotsFolder"]=2
  136.     },
  137.     ["RbxAnalyticsService"]={
  138.         ["GetClientId"]=1
  139.     },
  140.     ["Players"]={
  141.         ["ReportAbuse"]=1
  142.     },
  143.     ["HttpRbxApiService"]={
  144.         ["GetAsync"]=1,
  145.     ["GetAsyncFullUrl"]=2,
  146.     ["GetDocumentationUrl"]=3,
  147.     ["PostAsync"]=4,
  148.     ["PostAsyncFullUrl"]=5,
  149.     ["RequestAsync"]=6,
  150.     ["RequestLimitedAsync"]=7
  151.     }
  152. }
  153. if cloneref(game):GetService("VideoCaptureService") then
  154.     namecall["VideoCaptureService"]={
  155.         ["GetCameraDevices"]=1
  156.     }
  157. end
  158. local c
  159. local old1,old2,old3,old4,old5,old8,old9,old10,old11,old12,old13,old14,old15,old16
  160. if hookfunction then
  161.     old5=hookfunction(getrenv().gcinfo,function(...)
  162.         return options.MemoryDetections and rd(1500,2500) or old5(...)
  163.     end)
  164.     if not is_sirhurt_closure then
  165.         for i,v in next,namecall do
  166.             for i2,v2 in next,v do
  167.                 local old7
  168.                 old7=hookfunction(i=="DataModel" and game[i2] or game[i][i2],function(...)
  169.                     if options.MaliciousNamecalls.Enabled then
  170.                         options.Output(("Malicious function%s attempted execution. Attempt denied."):format(options.MaliciousNamecalls.ShowNamecall and " game."..(i~="DataModeL"and i.."."..i2) or i2 or ""))
  171.                         return not checkcaller() and old7(...)or nil
  172.                     end
  173.                     return old7(...)
  174.                 end)
  175.             end
  176.         end
  177.     end
  178.     old13=hookfunction(Instance.new("BindableEvent").Fire,function(...)
  179.         return not options.ChatBan.Enabled and old13(...) or self==MessagePostedEvent and options.Output("MessagePosted usage was attempted. Attempt denied.") or old13(...)
  180.     end)
  181.     old12=hookfunction(ChatBar.CaptureFocus,function(...)
  182.         if options.ChatBan.Enabled and options.ChatBan.Slash then
  183.             options.Output("Chat focus capture as local player was attempted. Attempt denied.")
  184.             if getcallingscript()~=ChatScript then
  185.                 if not c then
  186.                     StarterGui:SetCore("SendNotification",{
  187.                         Title="WARNING!",
  188.                         Text="There is an attempt to force you to chat in game."..getcallingscript():GetFullName(),
  189.                         Button1="Okay!",
  190.                         Duration=15
  191.                     })
  192.                     StarterGui:SetCore("SendNotification",{
  193.                         Title="What to do",
  194.                         Text="If it is due to a script, rejoin and do not execute it again. Otherwise, go there (through dex) and disable/delete it.",
  195.                         Button1="Okay!",
  196.                         Duration=15
  197.                     })
  198.                     if getcallingscript() then
  199.                     setclipboard(getcallingscript():GetFullName())
  200.                         StarterGui:SetCore("SendNotification",{
  201.                             Title="Copied to clipboard",
  202.                             Text="The path has also been copied to clipboard so you won't lose it in case this warning is gone too fast.",
  203.                             Button1="Okay!",
  204.                             Duration=15
  205.                         })
  206.                     end
  207.                     c="e"
  208.                 end
  209.             end
  210.             return
  211.         end
  212.         return old12(...)
  213.     end)
  214.     old8=hookfunction(Content.PreloadAsync,function(...)
  215.         local args={...}
  216.         return options.GUIDetection and (args[1]==Content and typeof(args[2])=="table" and options.Output("GUI detection attempted. Attempt denied.")) or old8(...)
  217.     end)
  218.     old9=hookfunction(Stats.GetTotalMemoryUsageMb,function(...)
  219.         local args={...}
  220.         return options.MemoryDetections and (args[1]==Stats and rd(400,550)) or old9(...)
  221.     end)
  222.     old10=hookfunction(game.Players.LocalPlayer.Kick,function(...)
  223.         local args={...}
  224.         return options.AntiKick and (args[1]==LocalPlayer and options.Output("Attempt to kick player denied.")) or old10(...)
  225.     end)
  226.     local oldd,oldd2
  227.     oldd=hookfunction(Instance.new("RemoteEvent").FireServer,newcclosure(function(self,...)
  228.         if options.ChatBan.Enabled and self==SayMessageRequest and getcallingscript()~=ChatMain then
  229.             return options.Output("SayMessageRequest remote event attempted to fire. Attempt denied.")
  230.         end
  231.         if checkcaller() then
  232.             if game.PlaceId==9551640993 and options.MiningSim and self==tr then
  233.                 return options.Output("Script attempted to confirm a potentially rigged/scam trade. Attempt denied.")
  234.             end
  235.         end
  236.         return oldd(self,...)
  237.     end))
  238.     if game.GameId==2316994223 then
  239.         local oldPet
  240.         oldPet=hookfunction(require(game:GetService("ReplicatedStorage").Library.Client.Network).Invoke,function(self,...)
  241.             if options.PetSim.Enabled and checkcaller() then
  242.                 local args={...}
  243.                 if self=="Invite To Bank" and options.PetSim.Bank then
  244.                     for i,v in next,args do print(i,v)end
  245.                     task.spawn(function()
  246.                         options.Output(("Script attempted to give user%saccess to your bank. Attempt denied."):format(options.PetSim.ShowUser and " named ".. Players:GetNameFromUserIdAsync(args[2]).." (ID: "..args[2]..") " or " "))
  247.                     end)
  248.                     return
  249.                 end
  250.                 if self=="Send Mail" and options.PetSim.Mail then
  251.                     for i,v in next,args do print(i,v)end
  252.                     task.spawn(function()
  253.                         options.Output(("Script attempted to send mail to a user%s. Attempt denied."):format(options.PetSim.ShowUser and " named ".. args[1]["Recipient"].." (ID: "..Players:GetUserIdFromNameAsync(args[1]["Recipient"])..") " or ""))
  254.                     end)
  255.                     return
  256.                 end
  257.             end
  258.             return oldPet(self,...)
  259.         end)
  260.             end
  261.     oldd2=hookfunction(Instance.new("RemoteFunction").InvokeServer,newcclosure(function(self,...)
  262.         if game.PlaceId==1537690962 and options.BeeSwarm and self==hiv then
  263.             return options.Output("Script attempted to place a basic bee egg, potentially for a fake dupe. Attempt denied.")
  264.         end
  265.         return oldd2(self,...)
  266.     end))
  267.     function ToString(tbl,level)
  268.         local tabString = "\t"
  269.         local tblString = "{\n"..tabString:rep(level)
  270.         local newLineString = ",\n"..tabString:rep(level)
  271.         for key,value in pairs(tbl) do
  272.             if type(value) == "table" then
  273.                 tblString = tblString  .. key .. "=" .. ToString(value,level+1)
  274.             else
  275.                 tblString = tblString  .. key .. "= " .. tostring(value):gsub("\n","") .. newLineString
  276.             end
  277.         end
  278.         return tblString..("\n%s}"):format(tabString:rep(level))
  279.     end
  280.     for i,v in next,hrequest do
  281.         if v then
  282.             local old6
  283.             old6=hookfunction(v,function(...)
  284.                 local args={...}
  285.                 if (strFind(args[1].Url,"webhook") or strFind(args[1].Url,"websec")) and options.AntiLog.Enabled then
  286.                     options.Output(("Script attempted to log info%s. Attempt denied. %s\n%s"):format(options.AntiLog.ShowDestination and " at "..args[1].Url or "",options.AntiLog.ShowInfo and "\nLogged info:\n"     ..(args[1].Body and ToString(game:GetService("HttpService"):JSONDecode(args[1].Body),1)or "None")or "",options.AntiLog.Payback and not is_sirhurt_closure and "Webhook was deleted." or ""))
  287.                     if options.AntiLog.Payback and not is_sirhurt_closure then
  288.                         args[1].Method="DELETE"
  289.                     else
  290.                         args[1].Url="https://google.com"
  291.                     end
  292.                     return old6(unpack(args))
  293.                 end
  294.                 if strFind(args[1].Url,"rpc") and options.AutoJoin.Enabled then
  295.                     options.Output(("Script attempted to auto join %s. Attempt denied."):format(options.AutoJoin.ShowServer and (args[1].Body and "https://discord.gg/"..game:GetService("HttpService"):JSONDecode(args[1].Body).args.code or "nil") or "a server"))
  296.                     return
  297.                 end
  298.                 if strMatch(args[1].Url,"%l+%.roblox%.com/v%d/") and options.AntiApi.Enabled then
  299.                     options.Output(("Script attempted to access the API%s. Attempt denied."):format(options.AntiApi.ShowEndpoint and " at "..args[1].Url or ""))
  300.                     return
  301.                 end
  302.                 return old6(...)
  303.             end)
  304.         end
  305.     end
  306.     old16=hookfunction(Instance.new("TextChannel").SendAsync,newcclosure(function(self,...)
  307.         if options.ChatBan.NewChat then
  308.             options.Output("New chat system message request attempted to fire. Attempt denied.")
  309.             return
  310.         end
  311.         return old16(self,...)
  312.     end))
  313.     --[[old3=hookfunction(getrenv().debug.info,function(self,params,...)
  314.         return options.Require and (self==2 and type(params)=="string" and old3(4,params,...)) or old3(...)
  315.     end)]]
  316.     --old4=hookmetamethod(Vector3.new(),"__index",newcclosure(function(self,b,...)
  317.     --    return options.BasicAntiCheatBypass and not table.find({LocalPlayer.PlayerScripts.PlayerModule.ControlModule,LocalPlayer.PlayerScripts.RbxCharacterSounds},getcallingscript()) and b:lower()=="magnitude" and (old4(self,b,...)<=savedProps.WalkSpeed and old4(self,b,...) or rd(0,savedProps.WalkSpeed)) or old4(self,b,...)
  318.     --end),false)
  319.     old14=hookfunction(LocalPlayer.IsInGroup,function(...)
  320.         local args={...}
  321.         return options.GroupBypass and (args[1]==LocalPlayer and typeof(args[2])=="number" and args[2]>0 and true) or old14(...)
  322.     end)
  323.     --[[old15=hookfunction(LocalPlayer.DistanceFromCharacter,function(...)
  324.         local args={...}
  325.         return not checkcaller() and (options.BasicAntiCheatBypass and (args[1]==LocalPlayer and typeof(args[2])=="Vector3" and (old15(...)<savedProps.WalkSpeed and old15(...) or rd(0,savedProps.WalkSpeed)))) or old15(...)
  326.     end)]]
  327. end
  328. local a
  329. if hookmetamethod then
  330.     old1=hookmetamethod(game,"__namecall",newcclosure(function(self,...)
  331.         local args={...}
  332.         local method=string.upper(string.sub(getnamecallmethod(),1,1))..string.sub(getnamecallmethod(),2,#getnamecallmethod())
  333.         if options.ChatBan.Enabled then
  334.             if method=="FireServer" and self==SayMessageRequest and getcallingscript()~=ChatMain then
  335.                 options.Output("SayMessageRequest remote event attempted to fire. Attempt denied.")
  336.                 return
  337.             elseif method=="SendAsync" and self.ClassName=="TextChannel" and options.ChatBan.NewChat then
  338.                 options.Output("New chat system message request attempted to fire. Attempt denied.")
  339.                 return
  340.             elseif method=="CaptureFocus" and self==ChatBar and options.ChatBan.Slash then
  341.                 options.Output("Chat focus capture as local player was attempted. Attempt denied.")
  342.                 if getcallingscript()~=ChatScript then
  343.                     if not a then
  344.                         StarterGui.SetCore(StarterGui,"SendNotification",{
  345.                             Title="WARNING!",
  346.                             Text="There is an attempt to force you to chat in game."..getcallingscript().GetFullName(getcallingscript()),
  347.                             Button1="Okay!",
  348.                             Duration=15
  349.                         })
  350.                         StarterGui.SetCore(StarterGui,"SendNotification",{
  351.                             Title="What to do",
  352.                             Text="If it is due to a script, rejoin and do not execute it again. Otherwise, go there (through dex) and disable/delete it.",
  353.                             Button1="Okay!",
  354.                             Duration=15
  355.                         })
  356.                         if getcallingscript() then
  357.                             setclipboard(getcallingscript().GetFullName(getcallingscript()))
  358.                             StarterGui.SetCore(StarterGui,"SendNotification",{
  359.                                 Title="Copied to clipboard",
  360.                                 Text="The path has also been copied to clipboard so you won't lose it in case this warning is gone too fast.",
  361.                                 Button1="Okay!",
  362.                                 Duration=15
  363.                             })
  364.                         end
  365.                         a="e"
  366.                     end
  367.                 end
  368.                 return
  369.             elseif method=="Fire" and self==MessagePostedEvent then
  370.                 options.Output("MessagePosted usage was attempted. Attempt denied.")
  371.                 return
  372.             end
  373.         end
  374.         if namecall[self.ClassName] and
  375.         namecall[self.ClassName][method] and options.MaliciousNamecalls.Enabled
  376.         then
  377.             options.Output(("Malicious namecall%s attempted execution. Attempt denied."):format(options.MaliciousNamecalls.ShowNamecall and " game."..self.GetFullName(self)..":"..method or ""))
  378.             return not checkcaller() and old1(...)or nil
  379.         end
  380.         --[[if not checkcaller() and method=="DistanceFromCharacter" and self==LocalPlayer and typeof(args[1])=="Vector3" and options.BasicAntiCheatBypass then
  381.             return old1(self,...)<savedProps.WalkSpeed and old1(self,...) or rd(0,savedProps.WalkSpeed)
  382.         end]]
  383.         if self==LocalPlayer and method=="Kick" and options.AntiKick then
  384.             options.Output("Attempt to kick player denied.")
  385.             return
  386.         end
  387.         if self==Stats and method=="GetTotalMemoryUsageMb" and options.MemoryDetections then
  388.             return rd(400,550)
  389.         end
  390.         if self==Content and method=="PreloadAsync" and typeof(args[1])=="table"and  options.GUIDetection then
  391.             return
  392.         end
  393.         if self==LocalPlayer and method=="IsInGroup" and typeof(args[1])=="number" and args[1]>0 and options.GroupBypass then
  394.             return true
  395.         end
  396.         if checkcaller() then
  397.             if game.PlaceId==9551640993 and options.MiningSim and self==tr and method=="FireServer" then
  398.                 options.Output("Script attempted to confirm a potentially rigged/scam trade. Attempt denied.")
  399.                 return
  400.             --[[elseif game.PlaceId==6284583030 and options.PetSim and self==bank and method=="InvokeServer" then
  401.                 local args={...}
  402.                 task.spawn(function()
  403.                     options.Output(("Script attempted to give user named %s (ID: %s) access to your bank. Attempt denied."):format(Players:GetNameFromUserIdAsync(args[1][2]),args[1][2]))
  404.                 end)
  405.                 return ]]
  406.             elseif game.PlaceId==1537690962 and options.BeeSwarm and self==hiv and method=="InvokeServer" then
  407.                 options.Output("Script attempted to place a basic bee egg, potentially a fake dupe. Attempt denied.")
  408.                 return
  409.             end
  410.         end
  411.         return old1(self,...)
  412.     end))
  413.     if getproperties then
  414.         repeat task.wait()until #Char:GetChildren()>0
  415.         for i,v in next,Char:GetChildren() do
  416.             savedProps[v]={}
  417.             for i2,v2 in next,getproperties(v) do
  418.                 if typeof(v2)~="Vector3" and typeof(v2)~="CFrame" then
  419.                     savedProps[v][i2]=v2
  420.                 end
  421.             end
  422.         end
  423.         old2=hookmetamethod(game,"__index",newcclosure(function(self,b,...)
  424.             if not checkcaller() and rawget(savedProps,self) and rawget(rawget(savedProps,self),b) and rawget(options,"BasicAntiCheatBypass") then
  425.                 return rawget(rawget(savedProps,self),b)
  426.             end
  427.             return old2(self,b,...)
  428.         end))
  429.     end
  430. end
  431. if is_sirhurt_closure then
  432.     local namecallSirhurt=(function()
  433.         local actual={}
  434.         for i,v in next,namecall do
  435.             for i2,v2 in next,v do
  436.                 table.insert(actual,i.."."..i2)
  437.             end
  438.         end
  439.         return actual
  440.     end)()
  441.     for i,v in next, namecallSirhurt do
  442.         local oldSir
  443.         oldSir=hookfunction(v:split(".")[1]=="DataModel" and game[v:split(".")[2]] or game[v:split(".")[1]][v:split(".")[2]],function(...)
  444.             if options.MaliciousNamecalls.Enabled then
  445.                 options.Output(("Malicious function%s attempted execution. Attempt denied."):format(options.MaliciousNamecalls.ShowNamecall and " game."..(i~="DataModeL"and i.."."..i2) or i2 or ""))
  446.                 return not checkcaller() and oldSir(...)or nil
  447.             end
  448.             return oldSir(...)
  449.         end)
  450.     end
  451.    
  452. end
  453.  
  454. if options.ClearTrace then
  455.     for i,v in next,getgc()do
  456.         if typeof(v)=="function" and execlosure(v) then
  457.             v=nil
  458.         end
  459.     end
  460. end
  461. if options.Error then
  462.     for i,v in next,getconnections(game:GetService("ScriptContext").Error) do
  463.     v:Disable()
  464.     end
  465. end
  466. if options.Message then
  467.     for i,v in next,getconnections(game:GetService("LogService").MessageOut) do
  468.     v:Disable()
  469.     end
  470. end
  471. if options.AntiIdle then
  472.     for i,v in next,getconnections(LocalPlayer.Idled) do
  473.     v:Disable()
  474.     end
  475. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement