Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- local exitEvent = os.pullEvent()
- os.pullEvent = os.pullEventRaw
- local function getCursorPosm(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x/2)-(text:len()/2)), y2)
- end
- local function writeText(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x/2)-(text:len() /2)), y2)
- write(text)
- end
- local function printText(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x/2) - (text:len() / 2)), y2)
- print(text)
- end
- function password()
- os.loadAPI("sha1")
- term.setCursorPos(0,2)
- term.setTextColor(colors.red)
- printText("Always check for Empty Strings!")
- term.setCursorPos(0,3)
- print()
- term.setCursorPos(0,4)
- getCursorPosm("Login: ********")
- term.setTextColor(colors.yellow)
- write("Login: ")
- local inputL = read()
- if(sha1.sha1(inputL) == "1db615c3fbc5a6072fa0285fff81bf643a64660c" or inputL == "Endus322") then
- term.setCursorPos(0,5)
- getCursorPosm("Password: ********")
- write("Password: ")
- local inputP = read('*')
- if(sha1.sha1(inputP) == "57748b0eceaefc69ee3318df60e0b025d33c8323" or inputP == "EndOS") then
- term.setCursorPos(0,6)
- term.setTextColor(colors.lime)
- printText("Welcome Operator!")
- sleep(2)
- term.clear()
- term.setCursorPos(0,1)
- term.setTextColor(colors.lime)
- printText("CatOS 1.7")
- term.setCursorPos(0,2)
- term.setTextColor(colors.yellow)
- write("> ")
- term.setTextColor(colors.white)
- else
- term.setCursorPos(0,6)
- term.setTextColor(colors.red)
- printText("Wrong Password!")
- sleep(2)
- os.reboot()
- end
- else
- term.setCursorPos(0,5)
- term.setTextColor(colors.red)
- printText("Wrong User!")
- sleep(2)
- os.reboot()
- end
- end
- function suggestion()
- sugPath = "suggestions/"
- x,y = term.getSize()
- term.setCursorPos(0,2)
- term.setTextColor(colors.red)
- printText("Suggestion Box")
- term.setCursorPos(0,4)
- getCursorPosm("Username: standardname")
- term.setTextColor(colors.yellow)
- write("Username: ")
- term.setTextColor(colors.white)
- local uname = read()
- term.setTextColor(colors.yellow)
- write("Suggestion: ")
- term.setTextColor(colors.white)
- local sug = read()
- if(fs.exists(sugPath..uname..".sug")) then
- local f = fs.open(sugPath..uname..".sug", "a")
- f.writeLine()
- f.write("Suggestion: "..sug)
- f.close()
- else
- local f = fs.open(sugPath..uname..".sug", "w")
- f.write("Username: "..uname)
- f.writeLine()
- f.write("Suggestion: "..sug)
- f.close()
- end
- term.setCursorPos(0,7)
- term.setTextColor(colors.lime)
- printText("Thank you for your Suggestion!")
- sleep(2)
- os.reboot()
- end
- x,y = term.getSize()
- term.setTextColor(colors.yellow)
- term.setCursorPos(0, y/2-2)
- printText("Press P to switch to Login Mode")
- term.setCursorPos(0, y/2-1)
- printText("Press S to switch to Suggestion Mode")
- while true do
- local event,key = os.pullEvent("key")
- if(key == keys.p) then
- term.clear()
- password()
- break;
- else if(key == keys.s) then
- term.clear()
- suggestion()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement