Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- MIT License
- Copyright © 2016 Chickenbreadlp
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- ]]
- local function get(branch, file)
- local response = http.get(
- "https://raw.githubusercontent.com/Chickenbreadlp/ReboOSt/"..branch.."/"..textutils.urlEncode( file )
- )
- if response then
- local sResponse = response.readAll()
- response.close()
- return sResponse
- else
- end
- end
- local function download(branch, filename, sFile)
- local sPath = shell.resolve( sFile )
- if fs.exists( sPath ) then
- return
- end
- -- GET the contents from pastebin
- local res = get(branch, filename)
- if res then
- local file = fs.open( sPath, "w" )
- file.write( res )
- file.close()
- end
- end
- local x = 1
- local y = {}
- local z = {}
- local syscrypt_pass = ""
- local function FirstCrypt(dir)
- if x == 1 then
- x = 0
- math.randomseed(tonumber(syscrypt_pass, 36))
- for i=1, 16 do
- y[i] = math.random(0, 0xFF)
- z[i] = math.random(0, 0xFF)
- end
- math.randomseed(math.random())
- local file = fs.open("/.syscrypt/reference_key", "w")
- file.writeLine('syscrypt_key = "'..hash.sha256(syscrypt_pass)..'"')
- file.close()
- end
- if dir == nil then dir = "" end
- local ListFiles = fs.list(dir)
- for _, file in ipairs(ListFiles) do
- if fs.isDir(dir..file) then
- if file ~= "rom" and file ~= ".syscrypt" then
- if fs.exists("/ReboOSt") and login == true then
- if file ~= ".SyscryptSetup" then
- FirstCrypt(dir.."/"..file.."/")
- end
- else
- FirstCrypt(dir.."/"..file.."/")
- end
- end
- else
- if file == "startup" then
- else
- local prog = fs.open(dir.."/"..file, "rb")
- local progData = {}
- local progbyte = prog.read()
- repeat
- table.insert(progData, progbyte)
- progbyte = prog.read()
- until progbyte == nil
- prog.close()
- progData = ccaes.encrypt_bytestream(progData, y, z)
- local prog = fs.open(dir.."/"..file, "wb")
- for i=1, #progData do
- prog.write(progData[i])
- end
- prog.close()
- sleep(0.01)
- end
- end
- end
- end
- if fs.exists("/.syscrypt") then
- error("Syscrypt is already installed on this pc")
- else
- term.setTextColor(colors.yellow)
- print("Please enter your password")
- term.setTextColor(1)
- write("Password: ")
- syscrypt_pass = read("*")
- if syscrypt_pass == "" then
- error("No Password provided")
- else
- if fs.exists("/ReboOSt") and login == true then
- if fs.exists("/User/.SyscryptSetup/..meta") then
- fs.delete("/User/.SyscryptSetup/..meta")
- end
- fs.makeDir("/User/.SyscryptSetup")
- fs.copy("/User/"..UserName.."/..meta", "/User/.SyscryptSetup/..meta")
- UserName = ".SyscryptSetup"
- end
- fs.makeDir("/.syscrypt")
- shell.run("pastebin", "get", "rCYDnCxn", "/.syscrypt/ccaes")
- download("release", "ReboOSt/APIs/encryption", "/.syscrypt/hash")
- os.loadAPI("/.syscrypt/ccaes")
- os.loadAPI("/.syscrypt/hash")
- syscrypt_pass = hash.sha256(syscrypt_pass)
- FirstCrypt()
- if fs.exists("/startup") then
- fs.move("/startup", "/.syscrypt/boot")
- end
- shell.run("pastebin", "get", "s3PazEbG", "startup")
- os.reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement