Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = { ... }
- if not args[1] then
- print("Usage:\n"
- .. "install <password>")
- return
- end
- function hash(str)
- local s = 0
- local p = ""
- for c in str:gmatch(".") do
- s = s + string.byte(c)
- end
- s = bit.bxor(65432895, s)
- while s > 0 do
- p = p .. string.char(s % 94 + 33)
- s = bit.brshift(s, 1)
- end
- return string.sub(p, 1, p:len() - 1)
- end
- local f = fs.open("/lock", "w")
- f.write([[local password = "]] .. hash(args[1]) .. [["
- os.pullEvent = os.pullEventRaw
- function hash(str)
- local s = 0
- local p = ""
- for c in str:gmatch(".") do
- s = s + string.byte(c)
- end
- s = bit.bxor(65432895, s)
- while s > 0 do
- p = p .. string.char(s % 94 + 33)
- s = bit.brshift(s, 1)
- end
- return string.sub(p, 1, p:len() - 1)
- end
- while true do
- term.clear()
- term.setCursorPos(1,1)
- if term.isColor() then term.setTextColor(colors.blue) end
- term.write("Liquid Obsidian's Authenticator v")
- if term.isColor() then term.setTextColor(colors.purple) end
- term.write("2.0")
- if term.isColor() then term.setTextColor(colors.orange) end
- for i = 0, i < 2 do print("") end
- term.write("Enter Password: ")
- local input = read("*")
- if hash(input) == password then
- term.clear()
- term.setCursorPos(1,1)
- printWithFormat("&5Access Granted!\n")
- return
- else
- printWithFormat("&1Access Denied!")
- sleep(2)
- end
- end]])
- f.close()
- f = fs.open("/startup", "w")
- f.write("shell.run('lock')")
- f.close()
- term.clear()
- term.setCursorPos(1, 1)
- local hiddenPassword = ""
- for i = 1, args[1]:len() do
- hiddenPassword = hiddenPassword .. "*"
- end
- term.setTextColor(colors.green)
- print("Auth installed with password " .. hiddenPassword .. "!")
- sleep(1.5)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement