Dustpuppy 16 Posted July 22, 2016 Share Posted July 22, 2016 Hi, now i'am getting complicated :-) Here's my security system. It's based on opensecurity and oc. ------------------------------------------------------------------------------------------------------------------------------- What's needed? The server Start it before starting any door computer or the card writer system. The server will handle all user accesses. The card writer This is the main system. It's with gui to setup all users. It needs an opensecurity card writer connected. You can setup new user, edit user or delete user. A user can be blocked to stop him using a mag card and a level can give to grant access on different doors. Data will be encrypted on the card. The door systems This will be used for the door it self. The computer needs a door controller and a card reader connected. You can use as much of this systems, as you want. It's important, that a door computer is started after the server, because it sends his access level to server during start. The level can be changed in the code. It's this line on the top : local accessLevel = 2 ------------------------------------------------------------------------------------------------------------------------------- All data will be send encrypted over network on port 199. The port and the crypting key can be changed in the source codes on top. Easy to find. :-) Downloads The server http://pastebin.com/Entk3KX5 The card writer http://pastebin.com/156Np04X - main program http://pastebin.com/Dfgc6z0T - the gui system (save it as gui.lua) The door computer http://pastebin.com/KwQjiQPD Hope u get it setup :-) If not, let me know. If i don't answer...good luck ;-) LarynxDE and maarten2000ha 2 Quote Link to post Share on other sites
Saddamo 3 Posted July 23, 2016 Share Posted July 23, 2016 I am going to try your program for casino security Casino slot machine V1.0 proof of concept: http://imgur.com/a/NHoZq slot machine chip inside: http://imgur.com/a/eCZFX Quote Link to post Share on other sites
Saddamo 3 Posted July 23, 2016 Share Posted July 23, 2016 I didnt have luck to make it working Quote Link to post Share on other sites
gamax92 3 Posted July 23, 2016 Share Posted July 23, 2016 Slightly off topic sorry but, that is a nice looking GUI, very nice job! Do you plan on separating it and making a separate library for it? Quote Link to post Share on other sites
Dustpuppy 16 Posted July 23, 2016 Author Share Posted July 23, 2016 It's allready a seperated lib. Just download the gui.lua. It's full documented in the source. Quote Link to post Share on other sites
Saddamo 3 Posted July 23, 2016 Share Posted July 23, 2016 Your security system is working, great job. The best I have seen, maybe it could do "beep" after the code is accepted. Would you like to make something like this with numeric "keypad" in OpenSecurity? Nothing fancy, just punch the code and output redstone signal with "beep" Quote Link to post Share on other sites
Dustpuppy 16 Posted July 24, 2016 Author Share Posted July 24, 2016 Computer gives a beep now, if access is granted. Quote Link to post Share on other sites
Dustpuppy 16 Posted July 24, 2016 Author Share Posted July 24, 2016 Here's a script for a door access with keypad. Don't need the server or the user database. local accessCode = "12345" local component = require("component") local gpu = component.gpu local event = require("event") local ser = require("serialization") local term = require("term") local computer = component.computer local door = component.os_door keypad = component.os_keypad customButtons = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "<", "0", "ok"} customButtonColor = {"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"} keypad.setKey(customButtons, customButtonColor) term.clear() print("Security door") print("---------------------------------------------------------------------------") local inputStr = "" while true do ev, address, button, button_label = event.pull("keypad") if ev then if button_label == "ok" then if inputStr == accessCode then term.write("Access granted\n") inputStr = "wellcome" keypad.setDisplay(inputStr) computer.beep() door.toggle() os.sleep(2) door.toggle() else term.write("Access denied\n") inputStr = "ERROR" keypad.setDisplay(inputStr) os.sleep(2) end inputStr = "" elseif button_label == "<" then if string.len(inputStr) > 0 then tmpStr = string.sub(inputStr, 1 , string.len(inputStr) -1) inputStr = tmpStr end else inputStr = inputStr .. button_label end keypad.setDisplay(inputStr) end os.sleep(0) end Quote Link to post Share on other sites
Saddamo 3 Posted July 24, 2016 Share Posted July 24, 2016 man,u r the best!!! I would be very happy, if I could show you, what I am going to use this. Thank you very much one more time Quote Link to post Share on other sites
Dustpuppy 16 Posted July 24, 2016 Author Share Posted July 24, 2016 Then make ur self happy and show me :-) Quote Link to post Share on other sites
Saddamo 3 Posted July 24, 2016 Share Posted July 24, 2016 I will use your security for casino and nuclear reactors entrance. Procedure how to get in: 1. punch the code that will open the door into a corridor 2. at the end of that corridor, use magnetic strip card to open next door 3. punch next code to start the nuclear reactor Reactor will start if: The battery is not charged more then 75% The temperarure is ok The manual safety switch is on I am making new advanced reactor IC chip for this I am not crazy, I just like it this way Quote Link to post Share on other sites
Saddamo 3 Posted July 28, 2016 Share Posted July 28, 2016 Thank you very much for awesome OpenComputers program Quote Link to post Share on other sites
TheCryptek 0 Posted August 20, 2016 Share Posted August 20, 2016 Would you be willing to get this working with the RFID Chip and readers, I want the doors to automatically open when say a level 10 access person walks up to a level 10 access door Quote Link to post Share on other sites
jhagrid77 4 Posted September 3, 2016 Share Posted September 3, 2016 Thank you for this wonderful script, I was going to do something like this till I saw it. Got disappointed xD, but when I looked through the code it's amazing. I'd like to recommend something, though. I'd like an area where the owner could change the security code written, maybe others would to? Quote Link to post Share on other sites
jhagrid77 4 Posted September 3, 2016 Share Posted September 3, 2016 Okay, after screwing around with your program, I thought of something. What if there was a log that was kept on the "Door" system, but unlike the output that is shown, it's a file that can be sent over the port other computers so that you (or whoever is Head Chief of Security) can read it on their own time.There should actually be two files in my opinion. One that is all successful attempts and one that is all failed. Both should be the same of course, showing the name of the player, the name of the card, the "password" on the card, and finally if it was locked when written or not. I made a little program thinking about it: http://pastebin.com/4pqh0L7J The problem is the fact that the data is everywhere. If you could figure out a way to fix it and incorporate it, I would be thankful. Quote Link to post Share on other sites
Dustpuppy 16 Posted September 3, 2016 Author Share Posted September 3, 2016 Okay, after screwing around with your program, I thought of something. What if there was a log that was kept on the "Door" system, but unlike the output that is shown, it's a file that can be sent over the port other computers so that you (or whoever is Head Chief of Security) can read it on their own time.There should actually be two files in my opinion. One that is all successful attempts and one that is all failed. Both should be the same of course, showing the name of the player, the name of the card, the "password" on the card, and finally if it was locked when written or not. I made a little program thinking about it: http://pastebin.com/4pqh0L7J The problem is the fact that the data is everywhere. If you could figure out a way to fix it and incorporate it, I would be thankful. I am not sure, what you mean. You can see at the server screen all infos. If access is granted, or denied and why. Would you be willing to get this working with the RFID Chip and readers, I want the doors to automatically open when say a level 10 access person walks up to a level 10 access door I will have a look, when i find the time. Quote Link to post Share on other sites
Dustpuppy 16 Posted September 3, 2016 Author Share Posted September 3, 2016 Was not as complicated as i thought.TheCryptek, here is your request :-) Just replace the mag card reader with a rfid reader and use this script. local accessLevel = 2 local cryptKey = {1, 2, 3, 4, 5} local modemPort = 199 local scanRange = 4 local component = require("component") local gpu = component.gpu local event = require("event") local ser = require("serialization") local term = require("term") local door = component.os_door local rfidreader = component.os_rfidreader local modem = component.modem local function convert( chars, dist, inv ) return string.char( ( string.byte( chars ) - 32 + ( inv and -dist or dist ) ) % 95 + 32 ) end local function crypt(str,k,inv) local enc= ""; for i=1,#str do if(#str-k[5] >= i or not inv)then for inc=0,3 do if(i%4 == inc)then enc = enc .. convert(string.sub(str,i,i),k[inc+1],inv); break; end end end end if(not inv)then for i=1,k[5] do enc = enc .. string.char(math.random(32,126)); end end return enc; end function splitString(str, sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) str:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end term.clear() print("Security door Access level : " .. tostring(accessLevel)) print("---------------------------------------------------------------------------") if modem.isOpen(modemPort) == false then modem.open(modemPort) end data = crypt(tostring(accessLevel), cryptKey) modem.broadcast(modemPort, "setlevel", data) while true do output = rfidreader.scan(scanRange) if output[1] ~= nil then local data = crypt(output[1].data, cryptKey, true) local tmpTable = splitString(data," ") term.write(tmpTable[3] .. ":") if modem.isOpen(modemPort) == false then modem.open(modemPort) end data = crypt(tmpTable[3], cryptKey) modem.broadcast(modemPort, "checkuser", data) local e, _, from, port, _, msg = event.pull(1, "modem_message") if e then data = crypt(msg, cryptKey, true) -- print(data) if data == "true" then term.write("Access granted\n") door.toggle() os.sleep(2) door.toggle() else term.write("Access denied\n") end else term.write("server timeout\n") end os.sleep(3) else os.sleep(0.5) end end Quote Link to post Share on other sites
jhagrid77 4 Posted September 3, 2016 Share Posted September 3, 2016 Sorry, it was really late last night when I wrote that. After looking on the Server System's screen, I see the information, however, I don't think I exactly understand it. What is the long string of data for? The UUID of the card? Then what about the numbers following it?Sorry about all the confusion I caused last night, and perhaps just now. Thank you for helping me out however. Quote Link to post Share on other sites
Dustpuppy 16 Posted September 3, 2016 Author Share Posted September 3, 2016 It displays the address of the sender:port:action:info Quote Link to post Share on other sites
jhagrid77 4 Posted September 3, 2016 Share Posted September 3, 2016 Sorry to keep bothering you, however, I have two final questions for you and your program. 1. What is the most "optimised" minimal setup this would work on? I'm thinking T2 since it needs a Wireless card, however, I'm not sure. 2. Am I allowed to use this for a kind of "Security Company" on a server I play on? Thank you for responding. Quote Link to post Share on other sites
Dustpuppy 16 Posted September 3, 2016 Author Share Posted September 3, 2016 1. Minimum is t1, if you use normal network cards. Only the userdb system needs a tier2 screen, because of the gui. 2. You can use it where ever you want, if you will not make money with it. ;-) Quote Link to post Share on other sites
jhagrid77 4 Posted September 6, 2016 Share Posted September 6, 2016 Well set up the keypad script for my friend on a server, it's possible to replace the door controller for either a Redstone I/O or Redstone Card. I can post the script here if anyone would like. Also to get back through you need another keypad since the script only supports one with the Custom Numbers and such, you have to make it the original numbers and such. Quote Link to post Share on other sites
PixelgamerX32 0 Posted October 20, 2016 Share Posted October 20, 2016 Hey Dustpuppy. I am having trouble making this work. Can you provide a set of instructions to set this up? Cause I don't know what to do. For example, step 1 download the programs... etc. Ignore that part XD, I only mean when setting the whole thing up apart from getting programs. Thanks. EDIT: Which components are being used in the systems, and tiers of the components used in each system? Quote Link to post Share on other sites
Sherlok 0 Posted March 31, 2017 Share Posted March 31, 2017 I m having trouble and if possible if you can help make it wireless. but everytime The server says player ok the door says access denied Quote Link to post Share on other sites
PixelgamerX32 0 Posted May 11, 2017 Share Posted May 11, 2017 So, I have a question. For example, if I use the Keypad version of the code, the keypad only faces one way right? My problem is this, how do I get out of a room that has a door with keypad input as it can be only accessed from outside the room. Is there a way to implement some kind of 'Door Release' mechanism, like for example, a button? Although I really like the keypad version, very nice Dust Puppy. Keep up the good work . Quote Link to post Share on other sites