Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local auth_channel = 54321
- local reply_channel = 234
- local authenticated = false
- while not authenticated do
- term.clear()
- term.setCursorPos(1,1)
- print("scs.mtweather.mil")
- print("Authorized Users Only")
- print("Access Attempts are Logged")
- print("What side is your wireless modem on: [left,right,top,back,bottom] ")
- local mSide = read()
- if mSide == "left" or mSide == "right" then
- local modem = peripheral.wrap(mSide)
- modem.open(reply_channel)
- modem.isOpen(reply_channel)
- elseif mSide == ("top") or mSide == ("back") then
- local modem = peripheral.wrap(mSide)
- modem.open(reply_channel)
- modem.isOpen(reply_channel)
- elseif mSide == ("bottom") or mSide == ("front") then
- local modem = peripheral.wrap(mSide)
- modem.open(reply_channel)
- modem.isOpen(reply_channel)
- else
- print("No modem on that side or none connected.")
- sleep(2)
- os.reboot()
- end
- write("Username: ")
- local username = read()
- write("Password: ")
- local password = read("*")
- local user_table = {["username"] = username, ["password"] = password}
- modem.transmit(auth_channel, reply_channel, textutils.serialize(user_table))
- local response = false
- while not response do
- local event, modem_side, sender, reply_channel, message = os.pullEvent("modem_message")
- if reply_channel == auth_channel then
- response = true
- if message == "valid" then
- modem.closeAll()
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome")
- authenticated = true
- break
- else
- modem.closeAll()
- print("Invalid Login")
- sleep(2)
- shell.run("Auth")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement