ravneravn

password server

May 23rd, 2013
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 = false
  7. local modem = peripheral.wrap("left")
  8. local valid = false
  9. users = {"test", "JVN1" }
  10. passwords = {"test", "4370" }
  11. senders = { 10, 11, 12 }
  12. modem.open(500)
  13. while true do
  14. event, senderId, message, distance = os.pullEvent("modem_message")
  15. for i,v in ipairs(senders) do
  16. if v == senderId then
  17. validSender = true
  18. break
  19. end
  20. end
  21. if validSender == true then
  22. for i,v in ipairs(users) do
  23. if message == v then
  24. valid = true
  25. password = passwords[i]
  26. break
  27. else
  28. valid = false
  29. end
  30. end
  31. if valid then
  32. modem.transmit(500, 500, senderId, password, true)
  33. else
  34. modem.transmit(500, 500, "Not Valid", true)
  35. end
  36. end
  37. end
RAW Paste Data