Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local update = false
- if fs.exists("/SecuritySystem") then
- update = true
- elseif fs.exists("/startup") then
- fs.makeDir("/SecuritySystem")
- fs.copy("/startup","/SecuritySystem/startup")
- end
- local w,h = term.getSize()
- local dlStatus = ""
- local num = 1
- local max = 4
- local function pastebin(id, file)
- dlStatus = dlStatus.."Downloading file "..tostring(num).."/"..tostring(max).."... "
- term.setCursorPos(1,1)
- term.write(dlStatus)
- local handle = fs.open(file,'w')
- local webH = http.get("http://pastebin.com/raw.php?i="..id)
- handle.write(webH.readAll())
- handle.close()
- webH.close()
- sleep(0.25)
- term.setCursorPos(1,h)
- term.write("["..string.rep("=",math.floor((w-2)/max)*num)..string.rep(" ",math.floor((w-2)/max)*(max-num)).."]")
- dlStatus = dlStatus.."Done.\n"
- num = num + 1
- end
- local function getPass()
- local inTerm = window.create(term.current(),w/2-6,h/2,13,1,true)
- local oldTerm = term.redirect(inTerm)
- term.setBackgroundColor(colors.gray)
- term.write(" ")
- term.setCursorPos(1,1)
- local out = read("*")
- term.redirect(oldTerm)
- term.clear()
- term.setCursorPos(1,1)
- return out
- end
- term.clear()
- term.setCursorBlink(false)
- if update then max = 3 end
- pastebin("UXtrdHKL","/startup")
- pastebin("QMPUPMdP","/SecuritySystem/changePass")
- if not update then pastebin("eNJju2fv","/SecuritySystem/logo") end
- pastebin("4e6hjKBF","/.apis/sha")
- sleep(0.5)
- os.loadAPI("/.apis/sha")
- local setPass = true
- if update and fs.exists("/SecuritySystem/.passhash") then
- term.clear()
- term.setCursorPos(1,1)
- print("Change password [Y/N]?")
- term.setCursorBlink(true)
- local _,key = os.pullEvent("key")
- term.setCursorBlink(false)
- sleep(0)
- if key==21 then
- setPass = true
- else
- setPass = false
- end
- end
- if setPass then
- while true do
- term.clear()
- term.setCursorPos(math.ceil((w-13)/2),h/2-2)
- term.write("New Password:")
- local newpass = getPass()
- term.setCursorPos(math.ceil((w-16)/2),h/2-2)
- term.write("Repeat Password:")
- local input = getPass()
- if newpass == input then
- local file = fs.open("/SecuritySystem/.passhash","w")
- file.write(sha.sha256(newpass))
- file.close()
- term.setCursorPos(math.ceil((w-16)/2),h/2)
- term.write("Password applied")
- sleep(2)
- break
- else
- term.setCursorPos(math.ceil((w-21)/2),h/2)
- term.write("Passwords don't match")
- sleep(2)
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- if not fs.exists("/.apis/AES") or not fs.exists("/filehidercli") or not fs.exists("/driveencrypter") then
- print("Would you like to install Drive Encrypter to add security? [Y/N]")
- sleep(0)
- term.setCursorBlink(true)
- local _, key = os.pullEvent("key")
- term.setCursorBlink(false)
- if key==21 then
- num = 1
- max = 3
- dlStatus = ""
- term.clear()
- pastebin("Jr58QNPF","/driveencrypter")
- pastebin("wQ1aUnpU","/filehidercli")
- pastebin("rCYDnCxn","/.apis/AES")
- term.clear()
- term.setCursorPos(1,1)
- end
- end
- print("Setup complete. Rebooting...")
- sleep(2)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment