Dark_Agent

undetected module for lua

Nov 18th, 2025 (edited)
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.81 KB | Cybersecurity | 0 0
  1. local CoreModule = {}
  2.  
  3. --[[-- credits: https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source --]]--
  4.  
  5. if getgenv().CoreModuleLoaded then
  6.     return getgenv().CoreModule
  7. end
  8. getgenv().CoreModuleLoaded = true
  9.  
  10. local function create_fallback(t, f, fallback)
  11.     if type(f) == t then return f end
  12.     return fallback
  13. end
  14.  
  15. local cloneref = create_fallback("function", cloneref, function(...) return ... end)
  16. local sethidden = create_fallback("function", sethiddenproperty or set_hidden_property or set_hidden_prop)
  17. local gethidden = create_fallback("function", gethiddenproperty or get_hidden_property or get_hidden_prop)
  18. local queueteleport = create_fallback("function", queue_on_teleport or (syn and syn.queue_on_teleport) or (fluxus and fluxus.queue_on_teleport))
  19. local httprequest = create_fallback("function", request or http_request or (syn and syn.request) or (http and http.request) or (fluxus and fluxus.request))
  20. local setclipboard = create_fallback("function", setclipboard or toclipboard or set_clipboard or (Clipboard and Clipboard.set))
  21. local firetouchinterest = create_fallback("function", firetouchinterest)
  22. local hookfunction = create_fallback("function", hookfunction)
  23. local hookmetamethod = create_fallback("function", hookmetamethod)
  24. local getnamecallmethod = create_fallback("function", getnamecallmethod or get_namecall_method)
  25. local checkcaller = create_fallback("function", checkcaller, function() return false end)
  26. local newcclosure = create_fallback("function", newcclosure, function(f) return f end)
  27. local getgc = create_fallback("function", getgc or get_gc_objects)
  28. local setthreadidentity = create_fallback("function", setthreadidentity or (syn and syn.set_thread_identity) or syn_context_set or setthreadcontext)
  29. local firesignal = create_fallback("function", firesignal or fire_signal)
  30. local replicatesignal = create_fallback("function", replicatesignal)
  31. local getconnections = create_fallback("function", getconnections or get_signal_cons)
  32. local setfflag = create_fallback("function", setfflag or set_fflag)
  33. local getfflag = create_fallback("function", getfflag or get_fflag)
  34. local isSignalReplicatable = create_fallback("function", issignalreplicate or issignalreplicateable)
  35.  
  36. -- File System Primitives
  37. local raw_writefile = create_fallback("function", writefile)
  38. local raw_readfile = create_fallback("function", readfile)
  39. local raw_isfile = create_fallback("function", isfile)
  40. local raw_makefolder = create_fallback("function", makefolder)
  41. local raw_isfolder = create_fallback("function", isfolder)
  42. local raw_delfile = create_fallback("function", delfile)
  43. local raw_delfolder = create_fallback("function", delfolder)
  44. local raw_getcustomasset = create_fallback("function", getcustomasset or getsynasset)
  45.  
  46. CoreModule.cloneref = cloneref
  47. CoreModule.sethidden = sethidden
  48. CoreModule.gethidden = gethidden
  49. CoreModule.queueteleport = queueteleport
  50. CoreModule.httprequest = httprequest
  51. CoreModule.setclipboard = setclipboard
  52. CoreModule.firetouchinterest = firetouchinterest
  53. CoreModule.hookfunction = hookfunction
  54. CoreModule.hookmetamethod = hookmetamethod
  55. CoreModule.getnamecallmethod = getnamecallmethod
  56. CoreModule.checkcaller = checkcaller
  57. CoreModule.newcclosure = newcclosure
  58. CoreModule.getgc = getgc
  59. CoreModule.setthreadidentity = setthreadidentity
  60. CoreModule.firesignal = firesignal
  61. CoreModule.replicatesignal = replicatesignal
  62. CoreModule.getconnections = getconnections
  63. CoreModule.setfflag = setfflag
  64. CoreModule.getfflag = getfflag
  65. CoreModule.isSignalReplicatable = isSignalReplicatable
  66.  
  67. -- File System Enhanced
  68. CoreModule.writefile = function(file, data, safe)
  69.     if not raw_writefile then return end
  70.     if safe == true then return pcall(raw_writefile, file, data) end
  71.     raw_writefile(file, data)
  72. end
  73.  
  74. CoreModule.readfile = function(file, safe)
  75.     if not raw_readfile then return end
  76.     if safe == true then return pcall(raw_readfile, file) end
  77.     return raw_readfile(file)
  78. end
  79.  
  80. CoreModule.isfile = function(file)
  81.     if raw_isfile then return raw_isfile(file) end
  82.     if CoreModule.readfile then
  83.         local success, result = pcall(function() return CoreModule.readfile(file) end)
  84.         return success and result ~= nil and result ~= ""
  85.     end
  86.     return false
  87. end
  88.  
  89. CoreModule.makefolder = raw_makefolder
  90. CoreModule.isfolder = raw_isfolder
  91. CoreModule.delfile = raw_delfile
  92. CoreModule.delfolder = raw_delfolder
  93.  
  94. CoreModule.getcustomasset = function(asset)
  95.     if raw_getcustomasset then
  96.         local success, result = pcall(function() return raw_getcustomasset(asset) end)
  97.         if success and result ~= nil and result ~= "" then return result end
  98.     end
  99.     return asset
  100. end
  101.  
  102. CoreModule.Services = setmetatable({}, {
  103.     __index = function(self, name)
  104.         local success, cache = pcall(function() return cloneref(game:GetService(name)) end)
  105.         if success and cache then
  106.             rawset(self, name, cache)
  107.             return cache
  108.         end
  109.         return nil
  110.     end
  111. })
  112.  
  113. CoreModule.PlaceId = game.PlaceId
  114. CoreModule.JobId = game.JobId
  115.  
  116. -- Modified per request: No services list, direct GetMouse assignment
  117. CoreModule.GetMouse = CoreModule.Services.Players.LocalPlayer:GetMouse()
  118.  
  119. CoreModule.GetPlayer = newcclosure(function(Name)
  120.     if not Name then return nil end
  121.     Name = tostring(Name):lower():gsub("%s", "")
  122.     local Players = CoreModule.Services.Players
  123.     local LocalPlayer = Players.LocalPlayer
  124.    
  125.     for _, x in next, Players:GetPlayers() do
  126.         if x ~= LocalPlayer then
  127.             if x.Name:lower():match(Name) then
  128.                 return x
  129.             elseif x.DisplayName:lower():match("^" .. Name) then
  130.                 return x
  131.             end
  132.         end
  133.     end
  134.     return nil
  135. end)
  136.  
  137. CoreModule.SafeCall = newcclosure(function(Function, ...)
  138.     local Success, Result = pcall(Function, ...)
  139.     if not Success then
  140.         warn("[CoreModule] Error: " .. tostring(Result))
  141.     end
  142.     return Success, Result
  143. end)
  144.  
  145. xpcall(function()
  146.     CoreModule.IsOnMobile = table.find({Enum.Platform.Android, Enum.Platform.IOS}, CoreModule.Services.UserInputService:GetPlatform())
  147. end, function()
  148.     CoreModule.IsOnMobile = CoreModule.Services.UserInputService.TouchEnabled and not CoreModule.Services.UserInputService.KeyboardEnabled
  149. end)
  150.  
  151. function CoreModule.EnableInstanceBypass()
  152.     if not hookfunction or not hookmetamethod or not newcclosure then return end
  153.    
  154.     local ProtectedLookup = setmetatable({}, {__mode = "k"})
  155.     local typeof = typeof
  156.    
  157.     local OldInstanceNew
  158.     OldInstanceNew = hookfunction(Instance.new, newcclosure(function(ClassName, Parent)
  159.         local Object = OldInstanceNew(ClassName, Parent)
  160.         if checkcaller() then
  161.             ProtectedLookup[Object] = true
  162.         end
  163.         return Object
  164.     end))
  165.  
  166.     local function CleanTable(Tbl)
  167.         local NewTable = {}
  168.         local Index = 1
  169.         for i = 1, #Tbl do
  170.             local Val = Tbl[i]
  171.             if not ProtectedLookup[Val] then
  172.                 NewTable[Index] = Val
  173.                 Index = Index + 1
  174.             end
  175.         end
  176.         return NewTable
  177.     end
  178.  
  179.     local OldNamecall
  180.     OldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(Self, ...)
  181.         local Method = getnamecallmethod()
  182.        
  183.         if not checkcaller() then
  184.             if ProtectedLookup[Self] then
  185.                 return nil
  186.             end
  187.  
  188.             if Method == "GetChildren" or Method == "GetDescendants" or Method == "GetPartsInPart" then
  189.                 local Result = OldNamecall(Self, ...)
  190.                 if typeof(Result) == "table" then
  191.                     return CleanTable(Result)
  192.                 end
  193.                 return Result
  194.             end
  195.  
  196.             if Method == "FindFirstChild" or Method == "FindFirstChildWhichIsA" or Method == "WaitForChild" then
  197.                 local Result = OldNamecall(Self, ...)
  198.                 if Result and ProtectedLookup[Result] then
  199.                     return nil
  200.                 end
  201.                 return Result
  202.             end
  203.  
  204.             if Method == "Raycast" then
  205.                 local Result = OldNamecall(Self, ...)
  206.                 if Result and Result.Instance and ProtectedLookup[Result.Instance] then
  207.                     return nil
  208.                 end
  209.                 return Result
  210.             end
  211.            
  212.             if Method == "FindPartOnRay" or Method == "FindPartOnRayWithIgnoreList" then
  213.                 local Hit, Pos, Norm, Mat = OldNamecall(Self, ...)
  214.                 if Hit and ProtectedLookup[Hit] then
  215.                     return nil, Pos, Norm, Mat
  216.                 end
  217.                 return Hit, Pos, Norm, Mat
  218.             end
  219.         end
  220.  
  221.         return OldNamecall(Self, ...)
  222.     end))
  223.  
  224.     local OldIndex
  225.     OldIndex = hookmetamethod(game, "__index", newcclosure(function(Self, Key)
  226.         if not checkcaller() then
  227.             if ProtectedLookup[Self] then
  228.                 return nil
  229.             end
  230.  
  231.             if Key == "Target" and typeof(Self) == "Instance" and Self:IsA("Mouse") then
  232.                 local Target = OldIndex(Self, Key)
  233.                 if Target and ProtectedLookup[Target] then
  234.                     return nil
  235.                 end
  236.                 return Target
  237.             end
  238.         end
  239.         return OldIndex(Self, Key)
  240.     end))
  241.  
  242.     local OldNewIndex
  243.     OldNewIndex = hookmetamethod(game, "__newindex", newcclosure(function(Self, Key, Value)
  244.         if not checkcaller() and ProtectedLookup[Self] then
  245.             return
  246.         end
  247.         return OldNewIndex(Self, Key, Value)
  248.     end))
  249.  
  250.     local OldToString
  251.     OldToString = hookfunction(tostring, newcclosure(function(Obj)
  252.         if not checkcaller() and typeof(Obj) == "Instance" and ProtectedLookup[Obj] then
  253.             return "Instance"
  254.         end
  255.         return OldToString(Obj)
  256.     end))
  257. end
  258.  
  259. return CoreModule
Advertisement
Add Comment
Please, Sign In to add comment