This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DerWisch's profile picture

Keycard Doorlock System

Started by DerWisch, 02 October 2012 - 07:56 AM
DerWisch #1
Posted 02 October 2012 - 09:56 AM
Description
I created a doorlock which uses floppies as keycards.

It consists of a (<securitylevels> * <chars per level>) character long masterkey which is, length depending on the access level, partitially saved on the keycard; a program which checks the connected diskdrive for floppies and a program which creates those keycards.

The doorlock only can achieve maximum security if correct set up
- Only people with the right access rights get access to their level keycards
- The computer is only reachable from within (use a setup like this for example)
- Only the part of the masterkey which is also in the level keycard is saved on the doorlocks computer

The door needs a computer and a disk drive, in some cases a turtle will be better than a computer because of the smaller hitbox (i. e. when the door would be covering the disk drive and you can't retrieve the keycard from within). The checker should be run as startup or started in/after the startup. The (for lower levels trimed) masterkey must be on the same computer as the checker and the full masterkey aswell as the creator is required on the computer which is used to generate keycards.

Code
example key (5 Levels, 6 CPL):
NUahBwkQ8tyvgxy6UxFBsy4c4B4pWX

Checker
http://pastebin.com/n9nL9iqE
pastebin get n9nL9iqE keychecker
Creator
http://pastebin.com/ntjhgfK7
pastebin get ntjhgfK7 keycreator

Thanks to immibis for his help with string.sub()!
korndog1999 #2
Posted 15 October 2012 - 12:38 AM
how do i use it
DerWisch #3
Posted 15 October 2012 - 08:14 AM
You place the door/computer/diskdrive like in the picture (https://dl.dropbox.c...s/Doorsetup.png)

Then you change the config in the keychecker file according to your needs


-- Config
local iLevel = 5 -- Securitylevel of this station
local iLevelLength = 6 -- length of a security level key
local sRsOutput = "bottom" -- Redstone output for the door
local iOpenTime = 3 -- amount of seconds the door should be open when opened from within
-- End of config

iLevel is the security level of the door, the higher the number the more secure is the doorlock.

iLevelLength determines how long the levels in the key are, the example key has 5 levels with each level 6 characters long

NUahBwkQ8tyvgxy6UxFBsy4c4B4pWX

Level1: NUahBw
Level2: kQ8tyv
Level3: gxy6Ux
Level4: FBsy4c
Level5: 4B4pWX

sRsOutput sets on which side of the computer the redstone output should be to open the door

iOpenTime is the amount of seconds the door is open when opened with a keypress on the terminal


Next you roll your face over the keyboard to get a proper random key add some upper case letters and youre done with the key :D/>/>

This random key you save on the key creator computer on which you install the keyCreator.

with this you can create keycards with your shortened key.

For security reasons only save the key matching to the door on the doorlock computer for instance a level 3 computer should only have the key:
NUahBwkQ8tyvgxy6Ux

while a level 5 computer must have the full key:
NUahBwkQ8tyvgxy6UxFBsy4c4B4pWX

The doorlock computer itself needs a file named "masterkey" which contains the key of the station and the keychecker (run it on startup either with shell.run("keychecker") in the startup file or rename it to "startup")

to prevent the door from being hacked with an disk with an startup file you should place a diskdrive on the other side of the computer with no access from the outside.



I hope you understood everything, I'm bad at explaining ^^
oasis9 #4
Posted 10 November 2012 - 02:32 PM
Thanks!

I don't think you're too bad at explaining!
oasis9 #5
Posted 10 November 2012 - 02:34 PM
Just one thing - what is "config"?

I may have a few other questions…
oasis9 #6
Posted 10 November 2012 - 02:57 PM
(removed)
oasis9 #7
Posted 10 November 2012 - 03:02 PM
I fixed that…
Now I need help with line 20!

error:
filename:20: attempt to index ? (a nil value)
oasis9 #8
Posted 10 November 2012 - 03:41 PM
Pls answer dude!!!
;( ::

PLS
daeprice #9
Posted 21 November 2012 - 10:11 PM
Just got finished putting these into my build. Getting errors in each.
In the Checker:


table: (hex number, and its different each time)

event=timer
startup:38: attempt to concatenate string and table

the other error is in the keymaker:

startup:21: attempt to perform arithmetic __mul on nil and number

any ideas? i love the theory of how this works, one of the best out there.
Expenox #10
Posted 23 November 2012 - 05:16 PM
Advanced lock system. Nicee.