Advertisement
miissso

sd

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