Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = { ... }
- if not args[1] or not args[2] then
- print("Usage:\n"
- .."install <pastebin id> <redstone side>")
- return
- end
- local f = fs.open(".auth", "w")
- f.write([[
- local get = "http://pastebin.com/raw.php?i=]] .. args[1] .. [["
- local side = "]] .. args[2] .. [["
- os.pullEvent = os.pullEventRaw
- function table.contains(table, element)
- for _, value in pairs(table) do
- if value == element then
- return true
- end
- end
- return false
- end
- local list = http.get(get).readAll()
- local f = fs.open(".authlist", "w")
- f.write(list)
- f.close()
- f = fs.open(".authlist", "r")
- list = textutils.unserialize(f.readAll())
- f.close()
- term.clear()
- term.setCursorPos(1, 1)
- if term.isColor() then term.setTextColor(colors.blue) end
- print("Liquid Obsidian's Authenticator v1.0")
- while true do
- local event, detector, username = os.pullEvent()
- if event == "player" then
- if table.contains(list, username) or username == "LiquidObsidian" then
- if term.isColor() then term.setTextColor(colors.green) end
- print("Access granted to " .. username .. ".")
- rs.setOutput(side, true)
- sleep(2)
- rs.setOutput(side, false)
- else
- if term.isColor() then term.setTextColor(colors.red) end
- print("Authentication denied for " .. username .. ".")
- end
- end
- end
- ]])
- f.close()
- local f = fs.open("startup", "w")
- f.write("shell.run('.auth')")
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement