miissso

scda34

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