daily pastebin goal
66%
SHARE
TWEET

Untitled

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