Advertisement
UnknownExploiter

Remote Console

Jan 27th, 2019
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.01 KB | None | 0 0
  1. -- Not made by me made by Vaeb mk
  2.  
  3. --[[
  4.  
  5.     -Created by Vaeb.
  6.  
  7. ]]
  8.  
  9. _G.scanRemotes = true
  10.  
  11. _G.ignoreNames = {
  12.     Event = true;
  13.     MessagesChanged = true;
  14. }
  15.  
  16. setreadonly(getrawmetatable(game), false)
  17. local pseudoEnv = {}
  18. local gameMeta = getrawmetatable(game)
  19.  
  20. local tabChar = "      "
  21.  
  22. local function getSmaller(a, b, notLast)
  23.     local aByte = a:byte() or -1
  24.     local bByte = b:byte() or -1
  25.     if aByte == bByte then
  26.         if notLast and #a == 1 and #b == 1 then
  27.             return -1
  28.         elseif #b == 1 then
  29.             return false
  30.         elseif #a == 1 then
  31.             return true
  32.         else
  33.             return getSmaller(a:sub(2), b:sub(2), notLast)
  34.         end
  35.     else
  36.         return aByte < bByte
  37.     end
  38. end
  39.  
  40. local function parseData(obj, numTabs, isKey, overflow, noTables, forceDict)
  41.     local objType = typeof(obj)
  42.     local objStr = tostring(obj)
  43.     if objType == "table" then
  44.         if noTables then
  45.             return objStr
  46.         end
  47.         local isCyclic = overflow[obj]
  48.         overflow[obj] = true
  49.         local out = {}
  50.         local nextIndex = 1
  51.         local isDict = false
  52.         local hasTables = false
  53.         local data = {}
  54.  
  55.         for key, val in next, obj do
  56.             if not hasTables and typeof(val) == "table" then
  57.                 hasTables = true
  58.             end
  59.  
  60.             if not isDict and key ~= nextIndex then
  61.                 isDict = true
  62.             else
  63.                 nextIndex = nextIndex + 1
  64.             end
  65.  
  66.             data[#data+1] = {key, val}
  67.         end
  68.  
  69.         if isDict or hasTables or forceDict then
  70.             out[#out+1] = (isCyclic and "Cyclic " or "") .. "{"
  71.             table.sort(data, function(a, b)
  72.                 local aType = typeof(a[2])
  73.                 local bType = typeof(b[2])
  74.                 if bType == "string" and aType ~= "string" then
  75.                     return false
  76.                 end
  77.                 local res = getSmaller(aType, bType, true)
  78.                 if res == -1 then
  79.                     return getSmaller(tostring(a[1]), tostring(b[1]))
  80.                 else
  81.                     return res
  82.                 end
  83.             end)
  84.             for i = 1, #data do
  85.                 local arr = data[i]
  86.                 local nowKey = arr[1]
  87.                 local nowVal = arr[2]
  88.                 local parseKey = parseData(nowKey, numTabs+1, true, overflow, isCyclic)
  89.                 local parseVal = parseData(nowVal, numTabs+1, false, overflow, isCyclic)
  90.                 if isDict then
  91.                     local nowValType = typeof(nowVal)
  92.                     local preStr = ""
  93.                     local postStr = ""
  94.                     if i > 1 and (nowValType == "table" or typeof(data[i-1][2]) ~= nowValType) then
  95.                         preStr = "\n"
  96.                     end
  97.                     if i < #data and nowValType == "table" and typeof(data[i+1][2]) ~= "table" and typeof(data[i+1][2]) == nowValType then
  98.                         postStr = "\n"
  99.                     end
  100.                     out[#out+1] = preStr .. string.rep(tabChar, numTabs+1) .. parseKey .. " = " .. parseVal .. ";" .. postStr
  101.                 else
  102.                     out[#out+1] = string.rep(tabChar, numTabs+1) .. parseVal .. ";"
  103.                 end
  104.             end
  105.             out[#out+1] = string.rep(tabChar, numTabs) .. "}"
  106.         else
  107.             local data2 = {}
  108.             for i = 1, #data do
  109.                 local arr = data[i]
  110.                 local nowVal = arr[2]
  111.                 local parseVal = parseData(nowVal, 0, false, overflow, isCyclic)
  112.                 data2[#data2+1] = parseVal
  113.             end
  114.             out[#out+1] = "{" .. table.concat(data2, ", ") .. "}"
  115.         end
  116.  
  117.         return table.concat(out, "\n")
  118.     else
  119.         local returnVal = nil
  120.         if (objType == "string" or objType == "Content") and (not isKey or tonumber(obj:sub(1, 1))) then
  121.             local retVal = '"' .. objStr .. '"'
  122.             if isKey then
  123.                 retVal = "[" .. retVal .. "]"
  124.             end
  125.             returnVal = retVal
  126.         elseif objType == "EnumItem" then
  127.             returnVal = "Enum." .. tostring(obj.EnumType) .. "." .. obj.Name
  128.         elseif objType == "Enum" then
  129.             returnVal = "Enum." .. objStr
  130.         elseif objType == "Instance" then
  131.             returnVal = obj.Parent and obj:GetFullName() or obj.ClassName
  132.         elseif objType == "CFrame" then
  133.             returnVal = "CFrame.new(" .. objStr .. ")"
  134.         elseif objType == "Vector3" then
  135.             returnVal = "Vector3.new(" .. objStr .. ")"
  136.         elseif objType == "Vector2" then
  137.             returnVal = "Vector2.new(" .. objStr .. ")"
  138.         elseif objType == "UDim2" then
  139.             returnVal = "UDim2.new(" .. objStr:gsub("[{}]", "") .. ")"
  140.         elseif objType == "BrickColor" then
  141.             returnVal = "BrickColor.new(\"" .. objStr .. "\")"
  142.         elseif objType == "Color3" then
  143.             returnVal = "Color3.new(" .. objStr .. ")"
  144.         elseif objType == "NumberRange" then
  145.             returnVal = "NumberRange.new(" .. objStr:gsub("^%s*(.-)%s*$", "%1"):gsub(" ", ", ") .. ")"
  146.         elseif objType == "PhysicalProperties" then
  147.             returnVal = "PhysicalProperties.new(" .. objStr .. ")"
  148.         else
  149.             returnVal = objStr
  150.         end
  151.         return returnVal
  152.     end
  153. end
  154.  
  155. function tableToString(t)
  156.     return parseData(t, 0, false, {}, nil, false)
  157. end
  158.  
  159. local detectClasses = {
  160.     BindableEvent = true;
  161.     BindableFunction = true;
  162.     RemoteEvent = true;
  163.     RemoteFunction = true;
  164. }
  165.  
  166. local classMethods = {
  167.     BindableEvent = "Fire";
  168.     BindableFunction = "Invoke";
  169.     RemoteEvent = "FireServer";
  170.     RemoteFunction = "InvokeServer";
  171. }
  172.  
  173. local realMethods = {}
  174.  
  175. for name, enabled in next, detectClasses do
  176.     if enabled then
  177.         realMethods[classMethods[name]] = Instance.new(name)[classMethods[name]]
  178.     end
  179. end
  180.  
  181. for key, value in next, gameMeta do pseudoEnv[key] = value end
  182.  
  183. local incId = 0
  184.  
  185. local function getValues(self, key, ...)
  186.     return {realMethods[key](self, ...)}
  187. end
  188.  
  189. gameMeta.__index, gameMeta.__namecall = function(self, key)
  190.     if not realMethods[key] or _G.ignoreNames[self.Name] or not _G.scanRemotes then return pseudoEnv.__index(self, key) end
  191.     return function(_, ...)
  192.         incId = incId + 1
  193.         local nowId = incId
  194.         local strId = "[RemoteSpy_" .. nowId .. "]"
  195.  
  196.         local allPassed = {...}
  197.         local returnValues = {}
  198.  
  199.         local ok, data = pcall(getValues, self, key, ...)
  200.  
  201.         if ok then
  202.             returnValues = data
  203.             print("\n" .. strId .. " ClassName: " .. self.ClassName .. " | Path: " .. self:GetFullName() .. " | Method: " .. key .. "\n" .. strId .. " Packed Arguments: " .. tableToString(allPassed) .. "\n" .. strId .. " Packed Returned: " .. tableToString(returnValues) .. "\n")
  204.         else
  205.             print("\n" .. strId .. " ClassName: " .. self.ClassName .. " | Path: " .. self:GetFullName() .. " | Method: " .. key .. "\n" .. strId .. " Packed Arguments: " .. tableToString(allPassed) .. "\n" .. strId .. " Packed Returned: [ERROR] " .. data .. "\n")
  206.         end
  207.  
  208.         return unpack(returnValues)
  209.     end
  210. end
  211.  
  212. print("\nRan Vaeb's RemoteSpy\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement