Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ver = '1.0.1'
- shell.run("rm check")
- --Prepare the computer
- check = "ver = '1.0.1'"
- rednet.open("back")
- shell.run("clear")
- --Clear function
- function user()
- write("Enter username: ")
- u = string.lower(read())
- write("Enter password: ")
- p = read("*")
- if u == "supercoolguy855" and p == "Ilovechariskship" then
- admin = 1
- login = 1
- elseif u == "guest" and p == "1234" then
- admin = 0
- login = 1
- else
- admin = 0
- login = 0
- end
- end
- function clear()
- shell.run("clear")
- term.setTextColor(colors.red)
- write("Central ")
- term.setTextColor(colors.orange)
- write("Control ")
- term.setTextColor(colors.yellow)
- write("Command ")
- term.setTextColor(colors.lime)
- print("v" .. ver)
- term.setTextColor(colors.green)
- print("Enter command:")
- end
- --News function
- function new()
- print("Version", ver, "added:")
- end
- --Function admin
- function notadmin()
- print("Please run this command under administrator permission")
- sleep(1)
- os.reboot()
- end
- --Program function
- function program()
- e1 = string.lower(read())
- if e1 == "backup" then
- if admin == 1 then
- shell.run("rm startup")
- shell.run("cp backup startup")
- os.reboot()
- else
- notadmin()
- end
- end
- if e1 == "clear" then
- clear()
- e1 = string.lower(read())
- end
- if e1 == "shutdown" then
- os.shutdown()
- end
- if e1 == "check" then
- if admin == 1 then
- shell.run("pastebin get WWcEkWD5 check")
- h = fs.open("check","r")
- c = h.readLine()
- if c ~= check then
- print("There is a newer version")
- write("Do you want to update this (Y/N):")
- yesorno = string.lower(read())
- if yesorno == "y" then
- shell.run("rm backup")
- shell.run("mv startup backup")
- shell.run("mv check startup")
- os.reboot()
- else
- os.reboot()
- end
- else
- print("This is the latest version")
- sleep(2)
- os.reboot()
- end
- else
- notadmin()
- end
- end
- if e1 == "update" then
- if admin == 1 then
- shell.run("rm backup")
- shell.run("cp startup backup")
- shell.run("pastebin get WWcEkWD5 startup")
- else
- notadmin()
- end
- end
- if e1 == "new" then
- print("Version", ver, "has:")
- read()
- os.reboot()
- end
- if e1 == "help" then
- print("Enter a command here")
- write("Here is a list of command: ")
- print("light, door")
- e1 = read()
- end
- if e1 == "hack" then
- if admin == 1 then
- shell.run("clear")
- print("Hacking protocol for Minh's devices")
- write("One or All: ")
- t = string.lower(read())
- if t == "one" then
- write("Enter the protocol: ")
- pro = string.lower(read())
- write("Enter the ID of the computer: ")
- x = tonumber(read())
- write("True of false: ")
- w = string.lower(read())
- rednet.send(x,w,pro)
- end
- if t == "all" then
- write("Enter a protocol: ")
- pro = string.lower(read())
- write("True or False: ")
- w = string.lower(read())
- rednet.broadcast(w,pro)
- end
- os.reboot()
- else
- notadmin()
- end
- end
- e2 = string.lower(read())
- if e2 == "help" then
- print("Enter a room")
- write("Here is a list: ")
- print("bathroom, bedroom, living room, kitchen, basement,level2")
- print(e1)
- e2 = string.lower(read())
- end
- if e1 == "rollback" then
- if admin == 1 then
- if e2 == "create" then
- shell.run("rm rollback")
- shell.run("cp startup rollback")
- end
- if e2 == "restore" then
- shell.run("rm startup")
- shell.run("cp rollback startup")
- end
- os.reboot()
- else
- notadmin()
- end
- end
- e3 = string.lower(read())
- if e3 == "help" then
- print("Enter true or false")
- print(e1)
- print(e2)
- end
- print("-------------")
- --Actual program
- if e1 == "light" then
- if e2 == "bathroom" then
- x = 45
- elseif e2 == "bedroom" then
- x = 44
- elseif e2 == "kitchen" then
- x = 43
- elseif e2 == "living room" then
- x = 48
- elseif e2 == "all" then
- x = 180503
- elseif e2 == "basement" then
- x = 65
- elseif e2 == "level2" then
- x = 77
- end
- if e3 == "on" then
- y = "true"
- elseif e3 == "off" then
- y = "false"
- end
- if x == 180503 then
- rednet.broadcast(y,"home")
- else
- rednet.send(x,y,"home")
- end
- end
- if e1 == "door" then
- if e2 == "basement" then
- x = 56
- elseif e2 == "exit" then
- x = 64
- elseif e2 == "level2" then
- x = 78
- end
- if e3 == "open" then
- y = "true"
- elseif e3 == "close" then
- y = "false"
- end
- rednet.send(x,y,"door")
- end
- end
- function loopro()
- clear()
- while true do
- program()
- end
- end
- --Booting up sequence
- function booting()
- term.setTextColor(colors.red)
- print("[Booting Sequence Initiated]")
- sleep(0.1)
- print("[Operating System Initiating]")
- sleep(0.1)
- print("[Operating System Initiated]")
- sleep(0.1)
- print("[Hacking Protocol Activating]")
- sleep(0.1)
- print("[Hacking Protocol Activated]")
- sleep(0.1)
- print("[Wireless Modem Initiating]")
- sleep(0.1)
- print("[Wireless Modem Initiated]")
- sleep(0.1)
- print("[Extending RAM]")
- sleep(1)
- print("[RAM Extended]")
- sleep(0.1)
- print("[CPU Initiating]")
- sleep(1)
- print("[CPU Initiated]")
- print("[Booting Sequence Completed]")
- sleep(1)
- term.setTextColor(colors.white)
- shell.run("clear")
- end
- --Looping program
- function loop()
- while true do
- program()
- end
- end
- --User information
- booting()
- user()
- if login == 1 then
- clear()
- loop()
- else
- print("Wrong username or/and password")
- sleep(2)
- os.shutdown()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement