Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Coded by SuicidalSTDz
- --License:
- --The code of "EnderOS" in any form is intellectual
- --property of SuicidalSTDz. You may not reproduce,
- --redistribute, or modify it in any way!
- --This OS stores User information in a hashed form. Making "hackers" tremble in fear >:) Not really...
- --The hash that EnderOS uses is Sha-256 and makes storage safer :)
- --If you find any bugs(I know there are a few) please report them on the CC Forums on the EnderOS thread!
- --Thank you for using EnderOS and enjoy!
- --Games
- --EnderOS includes SkullPong by Skullblade, AdventureCraft by Mikee251, and FireWolf by GravityScore
- --11
- local nonEditableFiles = {
- "/.EnderOS/.userInfo",
- "/.EnderOS/.passInfo",
- "/.EnderOS/.userHint",
- "/.EnderOS/.firewolf",
- "/.EnderOS/.edit",
- ".EnderOS/.userInfo",
- ".EnderOS/.passInfo",
- ".EnderOS/.userHint",
- ".EnderOS/.firewolf",
- ".EnderOS/.edit",
- "startup"
- }
- local version = "v3.0"
- local saltHash = "T01hFg62zY"
- local adventureCraft = ""
- local firewolf = "A7wGH3ty"
- local edit = ""
- local skullpong = ""
- local userWrite = io.open("/.EnderOS/.userInfo","w")
- local userRead = io.open("/.EnderOS/.userInfo","r")
- local passWrite = io.open("/.EnderOS/.passInfo","w")
- local passRead = io.open("/.EnderOS/.passInfo","r")
- local hintWrite = io.open("/.EnderOS/.userHint","w")
- local hintRead = io.open("/.EnderOS/.userHint","r")
- local function reset() --FINISHED
- term.clear()
- term.setCursorPos(1,1)
- end
- local function sha256(msg) --FINISHED
- local function band(int1, int2, int3, ...)
- local ret =
- ((int1%0x00000002>=0x00000001 and int2%0x00000002>=0x00000001 and 0x00000001) or 0)+
- ((int1%0x00000004>=0x00000002 and int2%0x00000004>=0x00000002 and 0x00000002) or 0)+
- ((int1%0x00000008>=0x00000004 and int2%0x00000008>=0x00000004 and 0x00000004) or 0)+
- ((int1%0x00000010>=0x00000008 and int2%0x00000010>=0x00000008 and 0x00000008) or 0)+
- ((int1%0x00000020>=0x00000010 and int2%0x00000020>=0x00000010 and 0x00000010) or 0)+
- ((int1%0x00000040>=0x00000020 and int2%0x00000040>=0x00000020 and 0x00000020) or 0)+
- ((int1%0x00000080>=0x00000040 and int2%0x00000080>=0x00000040 and 0x00000040) or 0)+
- ((int1%0x00000100>=0x00000080 and int2%0x00000100>=0x00000080 and 0x00000080) or 0)+
- ((int1%0x00000200>=0x00000100 and int2%0x00000200>=0x00000100 and 0x00000100) or 0)+
- ((int1%0x00000400>=0x00000200 and int2%0x00000400>=0x00000200 and 0x00000200) or 0)+
- ((int1%0x00000800>=0x00000400 and int2%0x00000800>=0x00000400 and 0x00000400) or 0)+
- ((int1%0x00001000>=0x00000800 and int2%0x00001000>=0x00000800 and 0x00000800) or 0)+
- ((int1%0x00002000>=0x00001000 and int2%0x00002000>=0x00001000 and 0x00001000) or 0)+
- ((int1%0x00004000>=0x00002000 and int2%0x00004000>=0x00002000 and 0x00002000) or 0)+
- ((int1%0x00008000>=0x00004000 and int2%0x00008000>=0x00004000 and 0x00004000) or 0)+
- ((int1%0x00010000>=0x00008000 and int2%0x00010000>=0x00008000 and 0x00008000) or 0)+
- ((int1%0x00020000>=0x00010000 and int2%0x00020000>=0x00010000 and 0x00010000) or 0)+
- ((int1%0x00040000>=0x00020000 and int2%0x00040000>=0x00020000 and 0x00020000) or 0)+
- ((int1%0x00080000>=0x00040000 and int2%0x00080000>=0x00040000 and 0x00040000) or 0)+
- ((int1%0x00100000>=0x00080000 and int2%0x00100000>=0x00080000 and 0x00080000) or 0)+
- ((int1%0x00200000>=0x00100000 and int2%0x00200000>=0x00100000 and 0x00100000) or 0)+
- ((int1%0x00400000>=0x00200000 and int2%0x00400000>=0x00200000 and 0x00200000) or 0)+
- ((int1%0x00800000>=0x00400000 and int2%0x00800000>=0x00400000 and 0x00400000) or 0)+
- ((int1%0x01000000>=0x00800000 and int2%0x01000000>=0x00800000 and 0x00800000) or 0)+
- ((int1%0x02000000>=0x01000000 and int2%0x02000000>=0x01000000 and 0x01000000) or 0)+
- ((int1%0x04000000>=0x02000000 and int2%0x04000000>=0x02000000 and 0x02000000) or 0)+
- ((int1%0x08000000>=0x04000000 and int2%0x08000000>=0x04000000 and 0x04000000) or 0)+
- ((int1%0x10000000>=0x08000000 and int2%0x10000000>=0x08000000 and 0x08000000) or 0)+
- ((int1%0x20000000>=0x10000000 and int2%0x20000000>=0x10000000 and 0x10000000) or 0)+
- ((int1%0x40000000>=0x20000000 and int2%0x40000000>=0x20000000 and 0x20000000) or 0)+
- ((int1%0x80000000>=0x40000000 and int2%0x80000000>=0x40000000 and 0x40000000) or 0)+
- ((int1>=0x80000000 and int2>=0x80000000 and 0x80000000) or 0)
- return (int3 and band(ret, int3, ...)) or ret
- end
- local function bxor(int1, int2, int3, ...)
- local ret =
- ((int1%0x00000002>=0x00000001 ~= (int2%0x00000002>=0x00000001) and 0x00000001) or 0)+
- ((int1%0x00000004>=0x00000002 ~= (int2%0x00000004>=0x00000002) and 0x00000002) or 0)+
- ((int1%0x00000008>=0x00000004 ~= (int2%0x00000008>=0x00000004) and 0x00000004) or 0)+
- ((int1%0x00000010>=0x00000008 ~= (int2%0x00000010>=0x00000008) and 0x00000008) or 0)+
- ((int1%0x00000020>=0x00000010 ~= (int2%0x00000020>=0x00000010) and 0x00000010) or 0)+
- ((int1%0x00000040>=0x00000020 ~= (int2%0x00000040>=0x00000020) and 0x00000020) or 0)+
- ((int1%0x00000080>=0x00000040 ~= (int2%0x00000080>=0x00000040) and 0x00000040) or 0)+
- ((int1%0x00000100>=0x00000080 ~= (int2%0x00000100>=0x00000080) and 0x00000080) or 0)+
- ((int1%0x00000200>=0x00000100 ~= (int2%0x00000200>=0x00000100) and 0x00000100) or 0)+
- ((int1%0x00000400>=0x00000200 ~= (int2%0x00000400>=0x00000200) and 0x00000200) or 0)+
- ((int1%0x00000800>=0x00000400 ~= (int2%0x00000800>=0x00000400) and 0x00000400) or 0)+
- ((int1%0x00001000>=0x00000800 ~= (int2%0x00001000>=0x00000800) and 0x00000800) or 0)+
- ((int1%0x00002000>=0x00001000 ~= (int2%0x00002000>=0x00001000) and 0x00001000) or 0)+
- ((int1%0x00004000>=0x00002000 ~= (int2%0x00004000>=0x00002000) and 0x00002000) or 0)+
- ((int1%0x00008000>=0x00004000 ~= (int2%0x00008000>=0x00004000) and 0x00004000) or 0)+
- ((int1%0x00010000>=0x00008000 ~= (int2%0x00010000>=0x00008000) and 0x00008000) or 0)+
- ((int1%0x00020000>=0x00010000 ~= (int2%0x00020000>=0x00010000) and 0x00010000) or 0)+
- ((int1%0x00040000>=0x00020000 ~= (int2%0x00040000>=0x00020000) and 0x00020000) or 0)+
- ((int1%0x00080000>=0x00040000 ~= (int2%0x00080000>=0x00040000) and 0x00040000) or 0)+
- ((int1%0x00100000>=0x00080000 ~= (int2%0x00100000>=0x00080000) and 0x00080000) or 0)+
- ((int1%0x00200000>=0x00100000 ~= (int2%0x00200000>=0x00100000) and 0x00100000) or 0)+
- ((int1%0x00400000>=0x00200000 ~= (int2%0x00400000>=0x00200000) and 0x00200000) or 0)+
- ((int1%0x00800000>=0x00400000 ~= (int2%0x00800000>=0x00400000) and 0x00400000) or 0)+
- ((int1%0x01000000>=0x00800000 ~= (int2%0x01000000>=0x00800000) and 0x00800000) or 0)+
- ((int1%0x02000000>=0x01000000 ~= (int2%0x02000000>=0x01000000) and 0x01000000) or 0)+
- ((int1%0x04000000>=0x02000000 ~= (int2%0x04000000>=0x02000000) and 0x02000000) or 0)+
- ((int1%0x08000000>=0x04000000 ~= (int2%0x08000000>=0x04000000) and 0x04000000) or 0)+
- ((int1%0x10000000>=0x08000000 ~= (int2%0x10000000>=0x08000000) and 0x08000000) or 0)+
- ((int1%0x20000000>=0x10000000 ~= (int2%0x20000000>=0x10000000) and 0x10000000) or 0)+
- ((int1%0x40000000>=0x20000000 ~= (int2%0x40000000>=0x20000000) and 0x20000000) or 0)+
- ((int1%0x80000000>=0x40000000 ~= (int2%0x80000000>=0x40000000) and 0x40000000) or 0)+
- ((int1>=0x80000000 ~= (int2>=0x80000000) and 0x80000000) or 0)
- return (int3 and bxor(ret, int3, ...)) or ret
- end
- local function bnot(int)
- return 4294967295 - int
- end
- local function rshift(int, by)
- local shifted = int / (2 ^ by)
- return shifted - shifted % 1
- end
- local function rrotate(int, by)
- local shifted = int / (2 ^ by)
- local fraction = shifted % 1
- return (shifted - fraction) + fraction * (2 ^ 32)
- end
- local k = {
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
- 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
- 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
- 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
- 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
- 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
- 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
- 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
- }
- local function str2hexa(s)
- local h = string.gsub(s, ".", function(c)
- return string.format("%02x", string.byte(c))
- end)
- return h
- end
- local function num2s(l, n)
- local s = ""
- for i = 1, n do
- local rem = l % 256
- s = string.char(rem) .. s
- l = (l - rem) / 256
- end
- return s
- end
- local function s232num(s, i)
- local n = 0
- for i = i, i + 3 do n = n*256 + string.byte(s, i) end
- return n
- end
- local function preproc(msg, len)
- local extra = 64 - ((len + 1 + 8) % 64)
- len = num2s(8 * len, 8)
- msg = msg .. "\128" .. string.rep("\0", extra) .. len
- return msg
- end
- local function initH256(H)
- H[1] = 0x6a09e667
- H[2] = 0xbb67ae85
- H[3] = 0x3c6ef372
- H[4] = 0xa54ff53a
- H[5] = 0x510e527f
- H[6] = 0x9b05688c
- H[7] = 0x1f83d9ab
- H[8] = 0x5be0cd19
- return H
- end
- local function digestblock(msg, i, H)
- local w = {}
- for j = 1, 16 do w[j] = s232num(msg, i + (j - 1) * 4) end
- for j = 17, 64 do
- local v = w[j - 15]
- local s0 = bxor(rrotate(v, 7), rrotate(v, 18), rshift(v, 3))
- v = w[j - 2]
- local s1 = bxor(rrotate(v, 17), rrotate(v, 19), rshift(v, 10))
- w[j] = w[j - 16] + s0 + w[j - 7] + s1
- end
- local a, b, c, d, e, f, g, h = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8]
- for i = 1, 64 do
- local s0 = bxor(rrotate(a, 2), rrotate(a, 13), rrotate(a, 22))
- local maj = bxor(band(a, b), band(a, c), band(b, c))
- local t2 = s0 + maj
- local s1 = bxor(rrotate(e, 6), rrotate(e, 11), rrotate(e, 25))
- local ch = bxor (band(e, f), band(bnot(e), g))
- local t1 = h + s1 + ch + k[i] + w[i]
- h, g, f, e, d, c, b, a = g, f, e, d + t1, c, b, a, t1 + t2
- end
- H[1] = band(H[1], a)
- H[2] = band(H[2], b)
- H[3] = band(H[3], c)
- H[4] = band(H[4], d)
- H[5] = band(H[5], e)
- H[6] = band(H[6], f)
- H[7] = band(H[7], g)
- H[8] = band(H[8], h)
- end
- msg = preproc(msg, #msg)
- local H = initH256({})
- for i = 1, #msg, 64 do digestblock(msg, i, H) end
- return str2hexa(num2s(H[1], 4) .. num2s(H[2], 4) .. num2s(H[3], 4) .. num2s(H[4], 4) ..
- num2s(H[5], 4) .. num2s(H[6], 4) .. num2s(H[7], 4) .. num2s(H[8], 4))
- end
- local function defineSettings() --FINISHED
- --Check if EnderOS is installed
- if not fs.exists("/.EnderOS/.EnderOSisInstalled") then
- fs.makeDir("/.EnderOS/")
- end
- local userRead = io.open("/.EnderOS/.userInfo","r")
- local userContents = userRead:read()
- userRead:close()
- if not fs.exists("/.EnderOS/.userInfo") or userContents == nil then
- repeat
- reset()
- term.setTextColor(colors.orange)
- print("Please enter your desired Username")
- term.setTextColor(colors.white)
- username = read()
- if #username <2 or username == "Username" or username == "username" then
- term.setTextColor(colors.red)
- print("The Endermen hack you in their sleep!")
- sleep(3)
- end
- sleep(0.1)
- until #username >2 and username ~= "Username" and username ~= "username"
- local hash = sha256(username..saltHash)
- local userWrite = io.open("/.EnderOS/.userInfo","w")
- userWrite:write(hash)
- userWrite:close()
- end
- local passRead = io.open("/.EnderOS/.passInfo","r")
- local passContents = passRead:read()
- passRead:close()
- if not fs.exists("/.EnderOS/.passInfo") or passContents == nil then
- repeat
- reset()
- term.setTextColor(colors.orange)
- print("Please enter your desired Password")
- term.setTextColor(colors.white)
- password = read("*")
- if #password <2 or password == "Password" or password == "password" then
- term.setTextColor(colors.red)
- print("The Endermen hack you in their sleep!")
- sleep(2.5)
- end
- sleep(0.1)
- local userRead = io.open("/.EnderOS/.userInfo","r")
- userContents = userRead:read()
- userRead:close()
- if userContents == sha256(password..saltHash) then
- term.setTextColor(colors.red)
- io.write("The Endermen prevent you from using the same Username and Password")
- sleep(2.5)
- end
- until #password >2 and password ~= "Password" and writePass ~= "password" and password ~= userContents
- local hash = sha256(password..saltHash)
- local passWrite = io.open("/.EnderOS/.passInfo","w")
- passWrite:write(hash)
- passWrite:close()
- end
- local hintRead = io.open("/.EnderOS/.userHint","r")
- local hintContents = hintRead:read()
- hintRead:close()
- if not fs.exists("/.EnderOS/.userHint") or hintContents == nil then
- repeat
- reset()
- term.setTextColor(colors.orange)
- print("Please enter your desired Password hint")
- term.setTextColor(colors.white)
- hint = read()
- if #hint >30 then
- term.setTextColor(colors.red)
- print("The Endermen revoke any hint greater than 30 characters!")
- sleep(2.5)
- return userInfo()
- end
- until #hint <=30
- local hintWrite = io.open("/.EnderOS/.userInfo","w")
- hintWrite:write(hint)
- hintWrite:close()
- end
- --Create a file saying EnderOS is installed
- if userContents ~= nil and passContents ~= nil and hintContents ~= nil and not fs.exists("/.EnderOS/.EnderOSisInstalled") then
- local installC = io.open("/.EnderOS/.EnderOSisInstalled", "w")
- installC:write("If said user happens to stumble across this file, said user shall leave said file alone!")
- installC:close()
- end
- end
- local function frame() --FINISHED
- print("+-------------------------------------------------+")
- for i = 1,17 do
- print("| |")
- end
- term.write("+-------------------------------------------------+")
- end
- local function screen() --FINISHED
- reset()
- term.setTextColor(colors.lime)
- print("+-------------------------------------------------+")
- print("| |")
- print("| ")
- term.setCursorPos(19,3)
- term.setTextColor(colors.purple)
- write("EnderOS "..version)
- term.setTextColor(colors.lime)
- term.setCursorPos(31,3)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(10,8)
- term.setTextColor(colors.orange)
- print("Username:")
- term.setCursorPos(19,8)
- print(" ")
- term.setCursorPos(50,8)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| ")
- term.setTextColor(colors.orange)
- term.setCursorPos(10,10)
- print("Password:")
- term.setCursorPos(19,10)
- print(" ")
- term.setCursorPos(50,10)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(8,13)
- term.setTextColor(colors.blue)
- print("Password Hint: ")
- term.setCursorPos(50,13)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- write("+-------------------------------------------------+")
- end
- local function login() --FINISHED
- if fs.exists("/.EnderOS/.lock") then --Checks if the user locked his/her computer
- term.setBackgroundColor(colors.black)
- userRead = io.open("/.EnderOS/.userInfo","r")
- userContents = userRead:read()
- userRead:close()
- passRead = io.open("/.EnderOS/.passInfo","r")
- passContents = passRead:read()
- passRead:close()
- repeat
- reset()
- term.setTextColor(colors.lime)
- frame()
- term.setCursorPos(11,4)
- term.setTextColor(colors.purple)
- term.write("This computer has been locked!")
- term.setCursorPos(15,8)
- term.setTextColor(colors.orange)
- term.write("Username:")
- term.setCursorPos(15,10)
- term.write("Password:")
- term.setCursorPos(25,8)
- term.setTextColor(colors.white)
- username = read()
- hashUsername = sha256(username..saltHash)
- term.setCursorPos(25,10)
- password = read("*")
- hashPassword = sha256(password..saltHash)
- until hashUsername == userContents and hashPassword == passContents
- fs.delete("/.EnderOS/.lock")
- return startScreen()
- end
- userRead = io.open("/.EnderOS/.userInfo","r")
- userContents = userRead:read()
- userRead:close()
- passRead = io.open("/.EnderOS/.passInfo","r")
- passContents = passRead:read()
- passRead:close()
- hintRead = io.open("/.EnderOS/.userHint","r")
- hintContents = hintRead:read()
- hintRead:close()
- while true do
- repeat
- screen()
- term.setCursorPos(23,13)
- term.setTextColor(colors.lightGray)
- print(hintContents)
- term.setTextColor(colors.white)
- term.setCursorPos(20,8)
- term.setTextColor(colors.white)
- username = read()
- hashU = sha256(username..saltHash)
- term.setCursorPos(20,10)
- term.setTextColor(colors.white)
- password = read("*")
- hashP = sha256(password..saltHash)
- until hashU == userContents and hashP == passContents
- break
- end
- --startScreen()
- end
- local function games() --FINISHED
- term.setTextColor(colors.purple)
- frame()
- term.setCursorPos(18,1)
- term.setTextColor(colors.lime)
- print("[EnderOS Games]")
- term.setCursorPos(3,3)
- print("{SkullPong} {AdventureCraft}")
- term.setCursorPos(3,1)
- term.setTextColor(colors.orange)
- term.write("[Back]")
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >=3 and xPos <=13 and yPos == 3) then
- shell.run("/.EnderOS/.skullpong")
- elseif (xPos >=3 and xPos <=9 and yPos == 1) then
- return startScreen()
- elseif (xPos >=17 and xPos <=32 and yPos == 3) then
- shell.run("/.EnderOS/.adventureCraft")
- else
- return games()
- end
- else
- return games()
- end
- end
- local function settings() --FINISHED
- local function changeUsername()
- repeat
- reset()
- term.setTextColor(colors.orange)
- local passContents = passRead:read()
- passRead:close()
- print("Please enter your password: ")
- term.setTextColor(colors.white)
- local input = read("*")
- local hash = sha256(input..saltHash)
- if hash ~= passContents then
- term.setTextColor(colors.red)
- print("Invalid password")
- sleep(1.5)
- end
- until hash == passContents
- repeat
- reset()
- term.setTextColor(colors.orange)
- print("Enter new username: ")
- term.setTextColor(colors.white)
- username = read()
- if #writeUser<=2 then
- term.setTextColor(colors.red)
- print("The Endermen hack you in their sleep!")
- sleep(3)
- end
- until #username>2
- local hash = sha256(writeUser..saltHash)
- userWrite:write(hash)
- userWrite:close()
- term.setTextColor(colors.lightBlue)
- print("Your new username is "..username)
- sleep(2)
- end
- local function changePassword()
- repeat
- reset()
- term.setTextColor(colors.orange)
- local passContents = passRead:read()
- passRead:close()
- print("Please enter your password: ")
- term.setTextColor(colors.white)
- local input = read("*")
- local hash = sha256(input..saltHash)
- if hash ~= passContents then
- term.setTextColor(colors.red)
- print("Invalid password")
- sleep(1.5)
- end
- until hash == passContents
- sleep(0.1)
- repeat
- term.setTextColor(colors.orange)
- print("Enter new password: ")
- term.setTextColor(colors.white)
- local password = read("*")
- if #password <=2 then
- term.setTextColor(colors.red)
- print("The Endermen hack you in their sleep!")
- sleep(3)
- end
- until #password >2
- local hash = sha256(password..saltHash)
- passWrite:write(hash)
- pass:close()
- term.setTextColor(colors.lightBlue)
- print("Your new password is "..password)
- sleep(2)
- end
- local function changeHint()
- repeat
- reset()
- term.setTextColor(colors.orange)
- local passContents = passRead:read()
- passRead:close()
- print("Please enter your password: ")
- term.setTextColor(colors.white)
- local input = read("*")
- local hash = sha256(input..saltHash)
- if hash ~= passContents then
- term.setTextColor(colors.red)
- print("Invalid password")
- sleep(1.5)
- end
- until hash == passContents
- sleep(0.1)
- repeat
- term.setTextColor(colors.orange)
- print("Enter new hint: ")
- term.setTextColor(colors.white)
- hint = read()
- if #hint >30 then
- term.setTextColor(colors.red)
- print("This Hint exceeds the max hint length of 30!")
- sleep(3)
- end
- until #hint <=30
- if hint == nil then return error("EnderOS has crashed: attempt to get length of nil; hint returned nil?") end
- hintWrite:write(hint)
- hintWrite:close()
- term.setTextColor(colors.lightBlue)
- print("Your new hint is "..hint)
- sleep(2)
- end
- local function uninstall()
- reset()
- term.setCursorPos(15,7)
- term.setTextColor(colors.purple)
- print("Uninstalling EnderOS")
- term.setCursorPos(17,9)
- term.setTextColor(colors.lime)
- term.write("[XX----------]")
- sleep(1)
- fs.delete("/.EnderOS/.EnderOSisInstalled")
- term.setCursorPos(17,9)
- term.write("[XXXX--------]")
- sleep(1)
- fs.delete("/.EnderOS/.userInfo")
- term.setCursorPos(17,9)
- term.write("[XXXXXX------]")
- sleep(1)
- fs.delete("/.EnderOS/.userHint")
- term.setCursorPos(17,9)
- term.write("[XXXXXXXX----]")
- sleep(1)
- fs.delete("/.EnderOS/.passInfo")
- term.setCursorPos(17,9)
- term.write("[XXXXXXXXXX--]")
- sleep(1)
- fs.delete("/.EnderOS/.firewolf")
- fs.delete("/.EnderOS")
- fs.delete(".Firewolf_Data")
- fs.delete(".Installer")
- term.setCursorPos(17,9)
- term.write("[XXXXXXXXXXXX]")
- sleep(1)
- reset()
- term.setCursorPos(12,7)
- term.setTextColor(colors.purple)
- term.write("Until next time - The Endermen")
- sleep(3)
- if fs.exists("EnderOS") then fs.delete("EnderOS") end
- local ender = io.open("EnderOS","w")
- ender:write("The file the Endermen made is called .Endermen")
- ender:close()
- reset()
- term.setTextColor(colors.white)
- print("The Endermen seem to have made a file that contains EnderOS for later use")
- sleep(4)
- if fs.exists("/.Endermen") then fs.delete("/.Endermen") end
- fs.move("startup",".Endermen")
- os.reboot()
- end
- local function settingScreen()
- term.setTextColor(colors.purple)
- frame()
- term.setCursorPos(17,1)
- term.setTextColor(colors.lime)
- print("[EnderOS Settings]")
- term.setCursorPos(7,3)
- print("{Change Username} {Change Password}")
- term.setCursorPos(3,5)
- print("{Change Password Hint} {Uninstall EnderOS}")
- term.setCursorPos(3,1)
- term.setTextColor(colors.orange)
- term.write("[Back]")
- term.setTextColor(colors.white)
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >=7 and xPos <=23 and yPos == 3) then --CHANGE USERNAME
- return changeUsername()
- elseif (xPos >=27 and xPos <=43 and yPos == 3) then --Change Password
- return changePassword()
- elseif (xPos >=3 and xPos <=24 and yPos == 5) then --Change Hint
- return changeHint()
- elseif (xPos >=28 and xPos <=46 and yPos == 5) then --Uninstall
- return uninstall()
- else
- return settingScreen()
- end
- else
- return settingScreen()
- end
- end
- end
- print("--------------------------------------------------")
- print(" Initializing...")
- print("--------------------------------------------------")
- if not http then return error("HTTP must be enabled to use EnderOS") end
- if not shell.getRunningProgram() == "startup" then return error("EnderOS must be in a startup file") end
- print("OS booting...")
- sleep(0.5)
- defineSettings()
- login()
Advertisement
Add Comment
Please, Sign In to add comment