Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Script Execution Spy
- Captures any Lua code that gets executed after this spy runs
- Works with Luarmor and other encrypted scripts
- ]]
- -- Create a folder to store captured scripts
- local spyFolder = "ScriptSpy_" .. os.time()
- makefolder(spyFolder)
- -- Store original functions
- local old_loadstring = loadstring
- local old_load = load
- local old_Instance_new = Instance.new
- -- Counter for captured scripts
- local scriptCounter = 0
- -- Function to capture and save code
- local function captureCode(code, source)
- if not code or type(code) ~= "string" then return end
- -- Only capture significant code (skip empty or very short)
- if #code > 200 then
- scriptCounter = scriptCounter + 1
- local filename = string.format("%s/script_%03d_%s.lua", spyFolder, scriptCounter, source or "unknown")
- -- Add header with timestamp and source
- local header = string.format("--[[ Captured Script #%d\n-- Source: %s\n-- Time: %s\n-- Size: %d bytes\n--]]\n\n",
- scriptCounter, source or "unknown", os.date("%Y-%m-%d %H:%M:%S"), #code)
- local fullCode = header .. code
- -- Try to save to file
- local success, err = pcall(function()
- writefile(filename, fullCode)
- end)
- if success then
- print(string.format("[SPY] Captured script #%d (%d bytes) saved to: %s", scriptCounter, #code, filename))
- else
- -- If writefile fails, try to print to console
- print(string.format("[SPY] Captured script #%d (%d bytes) - cannot save file", scriptCounter, #code))
- print("===== START CODE =====")
- print(string.sub(code, 1, 2000)) -- Print first 2000 chars
- print("===== END CODE =====")
- end
- -- Try to copy to clipboard if supported
- pcall(setclipboard, fullCode)
- end
- end
- -- Hook loadstring
- loadstring = function(code, chunkname)
- captureCode(code, "loadstring_" .. (chunkname or "unknown"))
- return old_loadstring(code, chunkname)
- end
- -- Hook load
- load = function(code, chunkname, mode, env)
- captureCode(code, "load_" .. (chunkname or "unknown"))
- return old_load(code, chunkname, mode, env)
- end
- -- Hook LocalScript creation
- Instance.new = function(className, parent)
- local instance = old_Instance_new(className, parent)
- if className == "LocalScript" or className == "ModuleScript" then
- -- Watch for scripts being created
- local oldSource = instance.Source
- local scriptName = instance.Name
- instance:GetPropertyChangedSignal("Source"):Connect(function()
- local newSource = instance.Source
- if newSource and newSource ~= oldSource and #newSource > 100 then
- captureCode(newSource, string.format("Instance_%s_%s", className, scriptName))
- oldSource = newSource
- end
- end)
- end
- return instance
- end
- -- Also hook RemoteFunction/Event triggers that might send code
- local old_FireServer = nil
- for _, service in pairs(game:GetDescendants()) do
- if service:IsA("RemoteFunction") or service:IsA("RemoteEvent") then
- if not old_FireServer then
- old_FireServer = service.FireServer
- service.FireServer = function(self, ...)
- local args = {...}
- for i, arg in pairs(args) do
- if type(arg) == "string" and #arg > 200 then
- captureCode(arg, string.format("Remote_%s_arg%d", self.Name, i))
- end
- end
- return old_FireServer(self, ...)
- end
- end
- end
- end
- print("[SPY] Script spy activated! Running the target script...")
- print("[SPY] Captured scripts will be saved to folder: " .. spyFolder)
- print("")
- -- Now run the target script
- loadstring(game:HttpGet("https://api.luarmor.net/files/v4/loaders/644bc1fd548dfde30e203fc6ba3734c8.lua"))()
- -- Keep spy active to catch any late-loading scripts
- task.spawn(function()
- while task.wait(1) do
- print("[SPY] Active - captured " .. scriptCounter .. " scripts so far")
- end
- end)
- print("[SPY] Target script executed. Check console for captures.")
Advertisement
Add Comment
Please, Sign In to add comment