JustDoesGames

Web Decoder (WD)

Nov 17th, 2020
1,338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. --[[
  2.  
  3. Web Decompressor
  4. Just Does Games
  5.  
  6. --]]
  7.  
  8. local args = {...}
  9. local web = "http://www.example.com"
  10.  
  11. local function c(t) print("[WD] "..t) end
  12.  
  13. web = args[1] or web
  14. if not http then return printError("Http is not enabled.") end
  15. local h = http.get(web)
  16. if h then
  17.     local t = {}
  18.     c("Connected to '"..web.."'!")
  19.     c("Downloading...") local i=1
  20.     while true do
  21.         local tmp = h.readLine()
  22.         if not tmp then break end
  23.         t[i] = tmp i=i+1
  24.     end i=nil
  25.     h.close()
  26.     c("Download Complete!")
  27.     c("Decompressing...")
  28.     local w = false
  29.     local f = fs.open("wd_out.lua", "w")
  30.     for i=1, #t do
  31.         local tmp = ""
  32.         for ii=1, t[i]:len() do
  33.             if t[i]:sub(ii,ii) == "<" or t[i]:sub(ii,ii) == ">" then
  34.                 w = not w
  35.             else
  36.                 if w then tmp = tmp..t[i]:sub(ii,ii) end
  37.             end
  38.         end
  39.         if tmp:len() > 0 then f.writeLine(tmp) end
  40.     end
  41.     f.close()
  42.     c("Complete. Output to 'wd_out.lua'")
  43. else
  44.     return printError("Failed to connect to '"..web.."'.")
  45. end
Advertisement
Add Comment
Please, Sign In to add comment