willthamic

keychecker

Oct 9th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. -- Config
  2. local securityLevel = 9
  3. local keyPartLength = 10
  4. local sRsOutput = "bottom"
  5. local diskSide = "right"
  6. local iOpenTime = 3
  7. -- End of config
  8.  
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. -- 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
  12. local sMKey = "B1SOK60PSX04GNUPTLCO5LHKJG54R3551HJL4ACIQHOLRPNK3DF21XLKI1NV6P2TMV4ZOJ5MAY7UYCWEAVJ067VGPJ"
  13. local stationKey = string.sub(sMKey, 1, securityLevel*keyPartLength)
  14.  
  15. os.pullEvent = os.pullEventRaw
  16. while (true) do
  17. if (disk.isPresent(diskSide)) then
  18. if fs.exists("disk/key") then
  19. shell.run("disk/key")
  20. if (string.len(key) >= string.len(stationKey)) then
  21. key = string.sub(key, 1, securityLevel*keyPartLength)
  22. if (key == stationKey) then
  23. disk.eject(diskSide)
  24. rs.setOutput(sRsOutput, true)
  25. sleep(iOpenTime)
  26. rs.setOutput(sRsOutput, false)
  27. end
  28. else
  29. disk.eject(diskSide)
  30. end
  31. else
  32. disk.eject(diskSide)
  33. end
  34. end
  35. sleep(0.1)
  36. end
Add Comment
Please, Sign In to add comment