Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Info
- Requires an advanced computer to run
- This program is designed as the validator for my keycard reader system. Since this computer SHOULDN'T have any openly accessible
- floppy disk drives connected to it, this program should be safe from hijacking attempts. This is the program that can be used
- to unlock doors, access a disk drive server, dispense stuff, etc.
- IMPORTANT: I put delays in the program to keep this program synced to my card reader program. If you plan on using a custom reader,
- feel free to remove them. Otherwise, keep them in.
- ]]--
- os.pullEvent = os.pullEventRaw
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.orange)
- print("Keycard Validation System V1")
- sleep(0.5)
- print("Please Wait...")
- -- Change to the side the reader will be connected to
- rednet.open("right")
- term.setTextColor(colors.green)
- print("Rednet Communications Opened!")
- sleep(1)
- -- Main Program (loops indefinitely)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.orange)
- -- You can change the text to say whatever
- print("Keycard Validation System")
- print("Waiting for keycard data...")
- id,IDdata = rednet.receive()
- term.setTextColor(colors.blue)
- print("Data Received...")
- -- ID checker - Checks ID number received from the card reader
- -- Change ### to ID number for the maintenance mode disk
- if IDdata == ### then
- term.setTextColor(colors.orange)
- print("Maintenance Card Detected!")
- sleep(1)
- rednet.broadcast("Break")
- print("Exiting to Terminal...")
- sleep(2)
- break;
- -- Add elseif statements for each ID you want validated (change the ### to the ID number of the disk)
- -- Copy this elseif statment to add more valid IDs
- elseif IDdata == ### then
- -- Delay is here for communications. Removing it may cause desync between systems
- term.setTextColor(colors.green)
- print("User Authorized!")
- name = "name goes here"
- valid = 1
- sleep(1)
- rednet.broadcast("Granted")
- else
- term.setTextColor(colors.red)
- -- Delay is here for communications. Removing it may cause desync between systems.
- sleep(1)
- rednet.broadcast("Denied")
- print("Invalid ID Detected!")
- print("Access Denied!")
- sleep(3)
- os.reboot()
- end
- -- If the ID was validated this will run
- if valid == 1 then
- term.setTextColor(colors.blue)
- print("Awaiting a response from the reader...")
- id,data = rednet.receive()
- if data == "resume" then
- rednet.broadcast(name)
- sleep(2)
- print("Response Received")
- -- Insert desired behavior here (e.g. break to terminal, unlock a door, or whatever)
- -- Demo Behavior, remove when editing
- rs.setOutput("left", true)
- sleep(2)
- rs.setOutput("left", false)
- else
- term.setTextColor(colors.red)
- print("Invalid Response")
- sleep(3)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement