Twisteds Remote Spy
Twisteds Remote Spy
getgenv().RemoteSpyEnabled = true
getgenv().Enabled = {
BindableEvent = false;
BindableFunction = false;
RemoteEvent = true;
RemoteFunction = true;
OnClientInvoke = true;
}
local Methods = {
BindableEvent = "Fire";
BindableFunction = "Invoke";
RemoteEvent = "FireServer";
RemoteFunction = "InvokeServer";
}
local Directory, FileName, FileType = "RemoteSpyLogs/", ("RemoteSpy Logs [%s_
%s]"):format(game.PlaceId, game.PlaceVersion), ".luau"
local GetFullName = game.GetFullName
local isexecutorfunction = isexecutorfunction or is_synapse_function or
isexecutorclosure or isourclosure or function(f) return getinfo(f,
"s").source:find("@") and true or false end
local hookmetamethod = hookmetamethod or newcclosure(function(Object, Metamethod,
Function)
local Metatable = assert(getrawmetatable(Object), ("bad argument #1 (%s does
not have a metatable)"):format(tostring(typeof(Object))))
local Original = assert(rawget(Metatable, Metamethod), "bad argument #2
(metamethod doesn't exist)")
assert(type(Function) == "function", "bad argument #3 (function expected)")
if isfile(FileName..FileType) then
local Name, Count = "", 0
repeat
Count += 1
Name = FileName..(" (%d)"):format(Count)
until not isfile(Directory..Name..FileType)
FileName = Name
if WriteToFile then
writefile(Directory..FileName..FileType, "")
end
end
for i = 1, #OriginalString do
String ..= "\\" .. string.byte(OriginalString, i, i)
end
return "\""..String.."\""
end
return "\""..OriginalString.."\""
end
return false
end
rconsoleprint(Content)
end
if Arguments.FunctionInfo then
return Save(("What: %s\nMethod: %s\nTo Script: %s\nTimestamp: %s\
nArguments: %s\nReturn: %s\nInfo: %s\nFunctionInfo: %s\nTraceback: %s\
n"):format(Arguments.What, Arguments.Method, Arguments.Script, Arguments.Timestamp,
Arguments.Arguments, Arguments.Response, Arguments.Info, Arguments.FunctionInfo,
Arguments.Traceback))
elseif Arguments.Response then
return Save(("What: %s\nMethod: %s\nFrom Script: %s\nTimestamp: %s\
nArguments: %s\nReturn: %s\nInfo: %s\nTraceback: %s\n"):format(Arguments.What,
Arguments.Method, Arguments.Script, Arguments.Timestamp, Arguments.Arguments,
Arguments.Response, Arguments.Info, Arguments.Traceback))
end
return true
end
task.spawn(function(...)
local Success, Response = SortArguments(pcall(Original, ...))
if self.ClassName:match("Function") then
Log({What = GetFullName(self), Method = Method, Script =
Info.short_src, Timestamp = Timestamp(), Arguments = Arguments, Info = Info,
Response = Response, Traceback = Traceback})
else
Log({What = GetFullName(self), Method = Method, Script =
Info.short_src, Timestamp = Timestamp(), Arguments = Arguments, Info = Info,
Traceback = Traceback})
end
coroutine.resume(Thread, unpack(Response))
end, ...)
return coroutine.yield()
end
task.spawn(function(...)
setnamecallmethod(Method)
local Success, Response = SortArguments(pcall(OldNamecall, ...))
repeat
task.wait()
until coroutine.status(Thread) == "suspended"
if self.ClassName:match("Function") then
Log({What = GetFullName(self), Method = Method, Script =
Info.short_src, Timestamp = Timestamp(), Arguments = Arguments, Info = Info,
Response = Response, Traceback = Traceback})
else
Log({What = GetFullName(self), Method = Method, Script =
Info.short_src, Timestamp = Timestamp(), Arguments = Arguments, Info = Info,
Traceback = Traceback})
end
coroutine.resume(Thread, unpack(Response))
end, ...)
return coroutine.yield()
end
syn.set_thread_identity(2)
SetFEnv(getfenv(Function))
Success, Response = SortArguments({pcall(Function, ...)}) --// you're loss ;)
SetFEnv(OldEnv)
syn.set_thread_identity(Old)
table.insert(Checked, Parsed)
--[[if not Success then --// Commented out because I know of an easy
way to bypass, but feel free to enable it if you wish
return coroutine.resume(Thread, unpack(Response))
end]]
if RemoteSpyEnabled then
Log({What = Name, Method = "InvokeClient", Script = Info.short_src,
Timestamp = Timestamp(), Arguments = {...}, FunctionInfo = FunctionInfo, Info =
Info, Response = not Success and "Script Error: "..Response or Response, Traceback
= Traceback})
end
return unpack(Response)
end)
end
return OldNewIndex(...)
end)