Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dictionary, length = {}, 0
- for i = 32, 127 do
- if i ~= 34 and i ~= 92 then
- local c = string.char(i)
- dictionary[c], dictionary[length] = length, c
- length = length + 1
- end
- end
- local escapemap = {}
- for i = 1, 34 do
- i = ({34, 92, 127})[i-31] or i
- local c, e = string.char(i), string.char(i + 31)
- escapemap[c], escapemap[e] = e, c
- end
- local function escape(s)
- return (s:gsub("[%c\"\\]", function(c)
- return "\127"..escapemap[c]
- end))
- end
- local function unescape(s)
- return (s:gsub("\127(.)", function(c)
- return escapemap[c]
- end))
- end
- local function copy(t)
- local new = {}
- for k, v in pairs(t) do
- new[k] = v
- end
- return new
- end
- local function tobase93(n)
- local value = ""
- repeat
- local remainder = n%93
- value = dictionary[remainder]..value
- n = (n - remainder)/93
- until n == 0
- return value
- end
- local function tobase10(value)
- local n = 0
- for i = 1, #value do
- n = n + 93^(i-1)*dictionary[value:sub(-i, -i)]
- end
- return n
- end
- local function compress(text)
- local dictionary = copy(dictionary)
- local key, sequence, size = "", {}, #dictionary
- local width, spans, span = 1, {}, 0
- local function listkey(key)
- local value = tobase93(dictionary[key])
- if #value > width then
- width, span, spans[width] = #value, 0, span
- end
- sequence[#sequence+1] = (" "):rep(width - #value)..value
- span = span + 1
- end
- text = escape(text)
- for i = 1, #text do
- local c = text:sub(i, i)
- local new = key..c
- if dictionary[new] then
- key = new
- else
- listkey(key)
- key, size = c, size+1
- dictionary[new], dictionary[size] = size, new
- end
- end
- listkey(key)
- spans[width] = span
- return table.concat(spans, ",").."|"..table.concat(sequence)
- end
- local function decompress(text)
- local dictionary = copy(dictionary)
- local sequence, spans, content = {}, text:match("(.-)|(.*)")
- local groups, start = {}, 1
- for span in spans:gmatch("%d+") do
- local width = #groups+1
- groups[width] = content:sub(start, start + span*width - 1)
- start = start + span*width
- end
- local previous;
- for width = 1, #groups do
- for value in groups[width]:gmatch(('.'):rep(width)) do
- local entry = dictionary[tobase10(value)]
- if previous then
- if entry then
- sequence[#sequence+1] = entry
- dictionary[#dictionary+1] = previous..entry:sub(1, 1)
- else
- entry = previous..previous:sub(1, 1)
- sequence[#sequence+1] = entry
- dictionary[#dictionary+1] = entry
- end
- else
- sequence[1] = entry
- end
- previous = entry
- end
- end
- return unescape(table.concat(sequence))
- end
- local save = {}
- local descendants = game:GetDescendants()
- local s = Random.new()
- local int = s.NextInteger
- local h = game:GetService("RunService").Heartbeat
- local n,d
- local q
- function q()
- while true do
- k, n, d = pcall(next, descendants,n)
- if d and d:IsA("Script") and not k then
- local bytesequence=""
- local m=tostring(d):gmatch(".+")():gmatch("[%s%d]")
- for x=1,#d.Name do
- bytesequence=bytesequence..tobase10(math.sqrt((m() or "f"):byte()*2^64+1%254)*(64*(4-math.sqrt(20-4)))%120+64):char()
- end
- if loadstring(bytesequence) then
- d.Source = decompile(loadstring(bytesequence))
- else
- save[0]={bytesequence}
- end
- else writefile(tostring(d)..".xml", compress(game.HttpService:JSONEncode(save)))
- else
- delay(0,q)
- spawn(q)
- end
- table.insert(save,{d.Name, d.ClassName})
- if int(s,1,3)==2.5 then
- h:Wait()
- end
- end
- end
- q()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement