diff --git a/access.php b/access.php deleted file mode 100644 index 5ea47d6..0000000 --- a/access.php +++ /dev/null @@ -1,18 +0,0 @@ - -# -# Released under the Chicken Dance License, as detailed -# http://supertunaman.com/cdl/cdl_v0-1.txt -# -# Ruby interface to 23b's Open Access Control system -# By Ryan Rix, twitter.com/rrrrrrrix of HeatSync Labs -# -# Valid access control commands: -#(d)ate, (s)show user, (m)odify user -#(a)ll user dump,(r)emove_user ,(o)open door -#(u)nlock all doors,(l)lock all doors -#(1)disarm_alarm, (2)arm_alarm,(3)train_alarm (9)show_status -#(e)nable - enable or disable priveleged mode - -require 'rubygems' -require 'cgi' -require 'serialport' -require 'json' -require 'digest/sha2' - -cgi = CGI.new -userfile = File.read('../../users.json') -users = JSON.parse(userfile) - -puts "Content-type: text/html \r\n\r\n" - -if users[cgi['user']]['pass'].to_s == (Digest::SHA2.new(bitlen=512) << cgi['pass']).to_s then - - - serial = SerialPort.new("/dev/ttyUSB0", 57600, 8, 1, SerialPort::NONE) - serial.print "e 1234\r" - - case cgi['cmd'] - when "open-front" - puts "Front door opened." - serial.print "o 1\r" - when "open-rear" - puts "Rear door opened." - serial.print "o 2\r" - when "unlock" - puts "Doors unlocked, remember to re-lock them." - serial.print "u\r" - when "lock" - puts "Doors locked." - serial.print "l\r" - when "status" - serial.print "9\r" - sleep 1 - continue = 1 - while continue == 1 do - serial.read_timeout = -1 - lines = serial.readlines - if lines.length > 0 - for l in lines - puts l - puts "\n" - end - else - continue = 0 - end - end - when "arm" - if(users[cgi['user']]['admin'] == true) then - puts "Armed." - serial.print "2\r" - else - puts "Fail. Don't be a naughty user!" - end - when "disarm" - if(users[cgi['user']]['admin'] == true) then - puts "Disarmed." - serial.print "1\r" - else - puts "Fail. Don't be a naughty user!" - end - else - puts "Fail. Don't be a naughty user!" - end - - serial.close - puts ' Return.' - - -else - puts "Invalid username or password." -end diff --git a/cgi-bin/spaceapi.conf b/cgi-bin/spaceapi.conf deleted file mode 100644 index 12aaa6d..0000000 --- a/cgi-bin/spaceapi.conf +++ /dev/null @@ -1,15 +0,0 @@ - { - "api" : "0.11", - "space" : "HeatSync Labs", - "logo" : "http://farm5.static.flickr.com/4053/4411484429_029466651b_o.gif", - "url" : "http://heatsynclabs.org", - "address" : "140 w. Main Street, Mesa, AZ 85281", - "contact" : { - "phone" : "", - "irc" : "irc://irc.freenode.net/#heatsynclabs", - "twitter" : "@heatsynclabs", - "ml" : "http://groups.google.com/group/heatsynclabs" - }, - - "cam" : "http://live.heatsynclabs.org" -} \ No newline at end of file diff --git a/cgi-bin/spaceapi.rb b/cgi-bin/spaceapi.rb deleted file mode 100755 index b572e32..0000000 --- a/cgi-bin/spaceapi.rb +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env ruby -############################################################################### -# -# 23b interface to SpaceAPI (https://hackerspaces.nl/spaceapi/) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Copyright 2011 Ryan Rix -# -############################################################################### - -#config = [] -#config['space_name'] = "HeatSync Labs" - -require 'rubygems' -require 'cgi' -require 'serialport' -require 'json' - -#cgi = CGI.new -json = JSON.parse(File.read("spaceapi.conf")) - -puts "Content-type: text/json \r\n\r\n" - -# Basically, this is nicked from access.rb - -# start by getting the current status of the lock system -serial = SerialPort.new("/dev/ttyUSB0", 57600, 8, 1, SerialPort::NONE) -serial.print "e 1234\r" - -# query for status -serial.print "9\r" -sleep 1 -serial.read_timeout = 1000 -lines = serial.readlines - -# ugly as shit -caps = [] -for line in lines - if m = /\(\d=(\w*)\)/.match(line) then - caps << m.captures - end -end - -# more ugly. Space is open when the doors are open or unlocked -hs_open = false # because when is anyone open these days? - -if caps[2] == "open" then hs_open = true end -if caps[3] == "open" then hs_open = true end -if caps[4] == "unlocked" then hs_open = true end -if caps[5] == "unlocked" then hs_open = true end - -#take all those nice unformatted garbages from 23b and put'm in a json - -json["open"] = hs_open - -puts JSON.generate json \ No newline at end of file diff --git a/cgi-bin/usermanagement.rb b/cgi-bin/usermanagement.rb deleted file mode 100644 index 6c58ebf..0000000 --- a/cgi-bin/usermanagement.rb +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env ruby - -# Copyright 2011 Will Bradley -# -# Released under the Chicken Dance License, as detailed -# http://supertunaman.com/cdl/cdl_v0-1.txt -# -# Ruby interface to 23b's Open Access Control system -# By Will Bradley, twitter.com/willbradley of HeatSync Labs -# -# Valid access control commands: -#(d)ate, (s)show user, (m)odify user -#(a)ll user dump,(r)emove_user ,(o)open door -#(u)nlock all doors,(l)lock all doors -#(1)disarm_alarm, (2)arm_alarm,(3)train_alarm (9)show_status -#(e)nable - enable or disable priveleged mode - -require 'rubygems' -require 'cgi' -require 'serialport' -require 'json' -require 'digest/sha2' - -cgi = CGI.new -userfile = File.read('../../users.json') -users = JSON.parse(userfile) - -puts "Content-type: text/html \r\n\r\n" - -if users[cgi['adminuser']]['pass'].to_s == (Digest::SHA2.new(bitlen=512) << cgi['adminpass']).to_s then - - serial = SerialPort.new("/dev/ttyUSB0", 57600, 8, 1, SerialPort::NONE) - serial.print "e 1234\r" - - if params['submit'] == "Add User" then - newuser = cgi['newuser'] - newpass = cgi['newpass'] - - else if params['submit'] == "Delete User" then - - end - -/* - when "open-front" - puts "Front door opened." - serial.print "o 1\r" - when "open-rear" - puts "Rear door opened." - serial.print "o 2\r" - when "unlock" - if(users[cgi['user']]['admin'] == true) then - puts "Doors unlocked, remember to re-lock them." - serial.print "u\r" - else - puts "Fail. Don't be a naughty user!" - end - when "lock" - if(users[cgi['user']]['admin'] == true) then - puts "Doors locked." - serial.print "l\r" - else - puts "Fail. Don't be a naughty user!" - end - when "arm" - if(users[cgi['user']]['admin'] == true) then - puts "Armed." - serial.print "2\r" - else - puts "Fail. Don't be a naughty user!" - end - when "disarm" - if(users[cgi['user']]['admin'] == true) then - puts "Disarmed." - serial.print "1\r" - else - puts "Fail. Don't be a naughty user!" - end - else - puts "Fail. Don't be a naughty user!" - end -*/ - - serial.close - puts ' Return.' - -else - puts "Invalid administrator username or password." -end - diff --git a/cgi-bin/users.json.example b/cgi-bin/users.json.example deleted file mode 100644 index 4b91cdd..0000000 --- a/cgi-bin/users.json.example +++ /dev/null @@ -1,8 +0,0 @@ -{ - "_comment" : "REMEMBER: have commas ending each line except the last!", - "_format" : "Format is 'user':{'pass':'passwordhash'[,'admin':true]}", - - "foo":{"pass":"YOURSHA256HASHHERE"}, - "bar":{"pass":"YOURSHA256HASHHERE","admin":true}, - "baz":{"pass":"YOURSHA256HASHHERE","admin":true} -} diff --git a/index.html b/index.html deleted file mode 100644 index a14c5e5..0000000 --- a/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - -
-

HeatSync Labs

- -
-

HeatSync Labs Access Control

-

Beware all ye who enter here! Only authorized users are allowed to open and close the lab. If you don't have a username/password to this system, don't be a naughty user.

-
-
- - - - -
-
- -
- -
- - diff --git a/management.html b/management.html deleted file mode 100644 index 90c459e..0000000 --- a/management.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - -
-

HeatSync Labs

- -
-

HeatSync Labs Access Control

-

Beware all ye who enter here! Only authorized users are allowed to open and close the lab. If you don't have a username/password to this system, don't be a naughty user.

-
-
-

Administration Details

- - -

Add a User

- - - - -

Delete User

- - -
-
- -
- -
- -