Advertisement
NukeVsCity

http modified

Aug 30th, 2023
1,115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.22 KB | None | 0 0
  1. --[[
  2.     HttpSpy v1.1.3
  3. ]]
  4.  
  5. assert(request or http_request, "Unsupported exploit (should support request or http_request)");
  6.  
  7. local options = ({...})[1] or { AutoDecode = true, Highlighting = true, SaveLogs = true, CLICommands = true, ShowResponse = true, BlockedURLs = {}, API = true };
  8. local version = "v1.1.3-modified";
  9. local logname = string.format("%d-%s-log.txt", game.PlaceId, os.date("%d_%m_%y"));
  10.  
  11. if options.SaveLogs then
  12.     writefile(logname, string.format("Http Logs from %s\n\n", os.date("%d/%m/%y")))
  13. end;
  14.  
  15. local Serializer = loadstring(game:HttpGet("https://raw.githubusercontent.com/NotDSF/leopard/main/rbx/leopard-syn.lua"))();
  16. local clonef = clonefunction;
  17. local pconsole = clonef(rconsoleprint);
  18. local format = clonef(string.format);
  19. local gsub = clonef(string.gsub);
  20. local match = clonef(string.match);
  21. local append = clonef(appendfile);
  22. local Type = clonef(type);
  23. local crunning = clonef(coroutine.running);
  24. local cwrap = clonef(coroutine.wrap);
  25. local cresume = clonef(coroutine.resume);
  26. local cyield = clonef(coroutine.yield);
  27. local Pcall = clonef(pcall);
  28. local Pairs = clonef(pairs);
  29. local Error = clonef(error);
  30. local getnamecallmethod = clonef(getnamecallmethod);
  31. local blocked = options.BlockedURLs;
  32. local enabled = true;
  33. local reqfunc = (syn or http).request;
  34. local libtype = syn and "syn" or "http";
  35. local hooked = {};
  36. local proxied = {};
  37. local methods = {
  38.     HttpGet = not syn,
  39.     HttpGetAsync = not syn,
  40.     GetObjects = true,
  41.     HttpPost = not syn,
  42.     HttpPostAsync = not syn
  43. }
  44.  
  45. Serializer.UpdateConfig({ highlighting = options.Highlighting });
  46.  
  47. local RecentCommit = game.HttpService:JSONDecode(game:HttpGet("https://api.github.com/repos/NotDSF/HttpSpy/commits?per_page=1&path=init.lua"))[1].commit.message;
  48. local OnRequest = Instance.new("BindableEvent");
  49.  
  50. local function printf(...)
  51.     if options.SaveLogs then
  52.         append(logname, gsub(format(...), "%\27%[%d+m", ""));
  53.     end;
  54.     return print(format(...)); -- Modified this
  55. end;
  56.  
  57.  
  58. local function ConstantScan(constant)
  59.     for i,v in Pairs(getgc(true)) do
  60.         if type(v) == "function" and islclosure(v) and getfenv(v).script == getfenv(saveinstance).script and table.find(debug.getconstants(v), constant) then
  61.             return v;
  62.         end;
  63.     end;
  64. end;
  65.  
  66. local function DeepClone(tbl, cloned)
  67.     cloned = cloned or {};
  68.  
  69.     for i,v in Pairs(tbl) do
  70.         if Type(v) == "table" then
  71.             cloned[i] = DeepClone(v);
  72.             continue;
  73.         end;
  74.         cloned[i] = v;
  75.     end;
  76.  
  77.     return cloned;
  78. end;
  79.  
  80. local __namecall, __request;
  81. __namecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
  82.     local method = getnamecallmethod();
  83.  
  84.     if methods[method] then
  85.         printf("game:%s(%s)\n\n", method, Serializer.FormatArguments(...));
  86.     end;
  87.  
  88.     return __namecall(self, ...);
  89. end));
  90.  
  91. local reqfunc = request or http_request;
  92. __request = hookfunction(reqfunc, newcclosure(function(req)
  93.     if Type(req) ~= "table" then return __request(req); end;
  94.    
  95.     local RequestData = DeepClone(req);
  96.     if not enabled then
  97.         return __request(req);
  98.     end;
  99.  
  100.     if Type(RequestData.Url) ~= "string" then return __request(req) end;
  101.  
  102.     if not options.ShowResponse then
  103.         printf("%s.request(%s)\n\n", libtype, Serializer.Serialize(RequestData));
  104.         return __request(req);
  105.     end;
  106.  
  107.     local t = crunning();
  108.     cwrap(function()
  109.         if RequestData.Url and blocked[RequestData.Url] then
  110.             printf("%s.request(%s) -- blocked url\n\n", libtype, Serializer.Serialize(RequestData));
  111.             return cresume(t, {});
  112.         end;
  113.  
  114.         if RequestData.Url then
  115.             local Host = string.match(RequestData.Url, "https?://(%w+.%w+)/");
  116.             if Host and proxied[Host] then
  117.                 RequestData.Url = gsub(RequestData.Url, Host, proxied[Host], 1);
  118.             end;
  119.         end;
  120.  
  121.         OnRequest:Fire(RequestData);
  122.  
  123.         local ok, ResponseData = Pcall(__request, RequestData); -- I know of a detection with this
  124.         if not ok then
  125.             Error(ResponseData, 0);
  126.         end;
  127.  
  128.         local BackupData = {};
  129.         for i,v in Pairs(ResponseData) do
  130.             BackupData[i] = v;
  131.         end;
  132.  
  133.         if BackupData.Headers["Content-Type"] and match(BackupData.Headers["Content-Type"], "application/json") and options.AutoDecode then
  134.             local body = BackupData.Body;
  135.             local ok, res = Pcall(game.HttpService.JSONDecode, game.HttpService, body);
  136.             if ok then
  137.                 BackupData.Body = res;
  138.             end;
  139.         end;
  140.  
  141.         printf("%s.request(%s)\n\nResponse Data: %s\n\n", libtype, Serializer.Serialize(RequestData), Serializer.Serialize(BackupData));
  142.         cresume(t, hooked[RequestData.Url] and hooked[RequestData.Url](ResponseData) or ResponseData);
  143.     end)();
  144.     return cyield();
  145. end));
  146.  
  147. if request then
  148.     replaceclosure(request, reqfunc);
  149. end;
  150.  
  151. if syn and syn.websocket then
  152.     local WsConnect, WsBackup = debug.getupvalue(syn.websocket.connect, 1);
  153.     WsBackup = hookfunction(WsConnect, function(...)
  154.         printf("syn.websocket.connect(%s)\n\n", Serializer.FormatArguments(...));
  155.         return WsBackup(...);
  156.     end);
  157. end;
  158.  
  159. -- I already know this will make some people mad :troll:
  160. if syn and syn.websocket then
  161.     local HttpGet;
  162.     HttpGet = hookfunction(getupvalue(ConstantScan("ZeZLm2hpvGJrD6OP8A3aEszPNEw8OxGb"), 2), function(self, ...)
  163.         printf("game.HttpGet(game, %s)\n\n", Serializer.FormatArguments(...));
  164.         return HttpGet(self, ...);
  165.     end);
  166.  
  167.     local HttpPost;
  168.     HttpPost = hookfunction(getupvalue(ConstantScan("gpGXBVpEoOOktZWoYECgAY31o0BlhOue"), 2), function(self, ...)
  169.         printf("game.HttpPost(game, %s)\n\n", Serializer.FormatArguments(...));
  170.         return HttpPost(self, ...);
  171.     end);
  172. end
  173.  
  174. for method, enabled in Pairs(methods) do
  175.     if enabled then
  176.         local b;
  177.         b = hookfunction(game[method], newcclosure(function(self, ...)
  178.             printf("game.%s(game, %s)\n\n", method, Serializer.FormatArguments(...));
  179.             return b(self, ...);
  180.         end));
  181.     end;
  182. end;
  183.  
  184. if not debug.info(2, "f") then
  185.     pconsole("You are running an outdated version, please use the loadstring at https://github.com/NotDSF/HttpSpy\n");
  186. end;
  187.  
  188. pconsole(format("HttpSpy %s (Creator: https://github.com/NotDSF)\nChange Logs:\n\t%s\nLogs are automatically being saved to: \27[32m%s\27[0m\n\n", version, RecentCommit, options.SaveLogs and logname or "(You aren't saving logs, enable SaveLogs if you want to save logs)"));
  189.  
  190. if not options.API then return end;
  191.  
  192. local API = {};
  193. API.OnRequest = OnRequest.Event;
  194.  
  195. function API:HookSynRequest(url, hook)
  196.     hooked[url] = hook;
  197. end;
  198.  
  199. function API:ProxyHost(host, proxy)
  200.     proxied[host] = proxy;
  201. end;
  202.  
  203. function API:RemoveProxy(host)
  204.     if not proxied[host] then
  205.         error("host isn't proxied", 0);
  206.     end;
  207.     proxied[host] = nil;
  208. end;
  209.  
  210. function API:UnHookSynRequest(url)
  211.     if not hooked[url] then
  212.         error("url isn't hooked", 0);
  213.     end;
  214.     hooked[url] = nil;
  215. end
  216.  
  217. function API:BlockUrl(url)
  218.     blocked[url] = true;
  219. end;
  220.  
  221. function API:WhitelistUrl(url)
  222.     blocked[url] = false;
  223. end;
  224.  
  225. return API;
  226.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement