Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Dustpuppy

Security system for opensecurity

Recommended Posts

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 ;-)

post-2821-0-93331200-1469216911_thumb.png

post-2821-0-77485900-1469216926_thumb.png

post-2821-0-21056400-1469216936_thumb.png

Link to post
Share on other sites

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" 

Link to post
Share on other sites

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

Link to post
Share on other sites

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 :D

Link to post
Share on other sites

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?

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 :P

I will have a look, when i find the time.

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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?

Link to post
Share on other sites

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 ;).

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.