Advertisement
johnnic431

R_Password_S

Jun 19th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("This is a password server. There is no user interaction here.")
  4. print("Please find a computer and login there.")
  5. local firstCycle = true
  6. local validSender = true
  7. local modemSide = "left" -- change to the side of the computer your modem is on
  8. local valid = false
  9. users = {"alion8me", "Nick" } --make sure users and passwords line up
  10. passwords = {"12346", "nick" }
  11. function bootUp()
  12.  rednet.open(modemSide)
  13. end
  14. while true do
  15.  validSender = true
  16.  if firstCycle then
  17.   bootUp()
  18.   firstCycle = false
  19.  end
  20.  senderId, message, distance = rednet.receive()
  21.  print("Request")
  22.  if validSender then
  23.   for i,v in ipairs(users) do
  24.    if message == v then
  25.     valid = true
  26.     password = passwords[i]
  27.     break
  28.    else
  29.     valid = false
  30.    end
  31.   end
  32.   if valid then
  33.    rednet.send(senderId, password, true)
  34.   end
  35.  end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement