In this branch, we DELETE EVERYTHING AND START OVER

This commit is contained in:
Will Bradley 2012-08-30 23:50:59 -07:00
parent ca711a7f1e
commit d6f1909591
8 changed files with 0 additions and 424 deletions

View File

@ -1,18 +0,0 @@
<?php
if(isset($_GET['id']))
$id = $_GET['id'];
if(isset($_GET['device']))
$device = $_GET['device'];
$accessdb = file_get_contents('../access-db.txt');
$access = explode("\n", $accessdb);
foreach($access as $line) {
$user = explode(" ", $line);
if(isset($user[2]) && strtoupper($user[2]) == strtoupper($id)) {
echo "^".$user[3]."|OK$";
}
}

View File

@ -1,89 +0,0 @@
#!/usr/bin/env ruby
# Copyright 2011 Ryan Rix <ry@n.rix.si>
#
# 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 <num> <usermask> <tagnumber>
#(a)ll user dump,(r)emove_user <num>,(o)open door <num>
#(u)nlock all doors,(l)lock all doors
#(1)disarm_alarm, (2)arm_alarm,(3)train_alarm (9)show_status
#(e)nable <password> - 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 ' <a href="/~access">Return.</a>'
else
puts "Invalid username or password."
end

View File

@ -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"
}

View File

@ -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 <http://www.gnu.org/licenses/>.
#
# Copyright 2011 Ryan Rix <ry@n.rix.si>
#
###############################################################################
#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

View File

@ -1,89 +0,0 @@
#!/usr/bin/env ruby
# Copyright 2011 Will Bradley <bradley.will@gmail.com>
#
# 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 <num> <usermask> <tagnumber>
#(a)ll user dump,(r)emove_user <num>,(o)open door <num>
#(u)nlock all doors,(l)lock all doors
#(1)disarm_alarm, (2)arm_alarm,(3)train_alarm (9)show_status
#(e)nable <password> - 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 ' <a href="/~access/management.html">Return.</a>'
else
puts "Invalid administrator username or password."
end

View File

@ -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}
}

View File

@ -1,70 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
body { background-color: #2C2C29; color: #2C2C29; font-family: Tahoma; font-size: 11px; margin: 0; padding: 0; }
#wrapper { width: 811px; margin: 0 auto; }
#top { background:url('http://www.heatsynclabs.org/wp-content/themes/lightword/images/header-image.png') no-repeat; height:116px; margin: 0 0 0 5px; }
#top span { display: none; }
#content { background-color: #fff; padding: 1em; font-size: 1.2em; }
.caption {
background-color: #F3F3F3;
border: 1px solid #DDD;
padding: 4px;
margin: 0 30px;
display: inline-block;
}
.footer {
clear: both;
}
label {
display: block;
font-weight: bold;
}
h2 {
font-family: Helvetica, Georgia;
font-size: 24px;
letter-spacing: -1px;
margin: 10px 0px 3px;
border-bottom: 1px solid #DCDCDB;
}
</style>
</head>
<body>
<div id="wrapper">
<a href="http://www.heatsynclabs.org"><h1 id="top"><span>HeatSync Labs</span></h1></a>
<div id="content">
<h2>HeatSync Labs Access Control</h2>
<p>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.</p>
<div class="caption">
<form method="post" action="cgi-bin/access.rb">
<label for="user">Username <input type="text" id="user" name="user" /></label>
<label for="pass">Password <input type="password" id="pass" name="pass" /></label>
<label for="cmd">Command
<select id="cmd" name="cmd">
<option value="open-rear">Open Rear Door</option>
<option value="open-front">Open Front Door</option>
<option value="lock">Lock all doors</option>
<option value="unlock">Unlock all doors</option>
<option value="arm">Arm alarm</option>
<option value="disarm">Disarm alarm</option>
<option value="status">System Status</option>
</select>
</label>
<input type="submit" id="submit" name="submit" value="Go!" />
</form>
</div>
<p class="footer">To report problems or ask for help/access, contact <a href="http://twitter.com/willbradley">@willbradley</a></p>
</div>
</div>
</body>
</html>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
body { background-color: #2C2C29; color: #2C2C29; font-family: Tahoma; font-size: 11px; margin: 0; padding: 0; }
#wrapper { width: 811px; margin: 0 auto; }
#top { background:url('http://www.heatsynclabs.org/wp-content/themes/lightword/images/header-image.png') no-repeat; height:116px; margin: 0 0 0 5px; }
#top span { display: none; }
#content { background-color: #fff; padding: 1em; font-size: 1.2em; }
.caption {
background-color: #F3F3F3;
border: 1px solid #DDD;
padding: 4px;
margin: 0 30px;
display: inline-block;
}
.footer {
clear: both;
}
label {
display: block;
font-weight: bold;
}
h2 {
font-family: Helvetica, Georgia;
font-size: 24px;
letter-spacing: -1px;
margin: 10px 0px 3px;
border-bottom: 1px solid #DCDCDB;
}
</style>
</head>
<body>
<div id="wrapper">
<a href="http://www.heatsynclabs.org"><h1 id="top"><span>HeatSync Labs</span></h1></a>
<div id="content">
<h2>HeatSync Labs Access Control</h2>
<p>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.</p>
<div class="caption">
<form method="post" action="cgi-bin/usermanage.rb">
<h3>Administration Details</h3>
<label for="adminuser">Admin Username <input type="text" id="adminuser" name="adminuser" /></label>
<label for="adminpass">Admin Password <input type="password" id="adminpass" name="adminpass" /></label>
<h3>Add a User</h3>
<label for="newuser">New Username <input type="text" id="newuser" name="newuser" /></label>
<label for="newpass">Password <input type="password" id="adminpass" name="adminpass" /></label>
<label for="isuseradmin">Grant Admin <input type="checkbox" id="isusradmin" name="isuseradmin" /></label>
<input type="submit" id="submit" name="submit" value="Add User" />
<h3>Delete User</h3>
<label for="deletename">Username <input type="text" id="deletename" name="deletename" /></label>
<input type="submit" id="submit" name="submit" value="Delete User" />
</form>
</div>
<p class="footer">To report problems or ask for help/access, contact <a href="http://twitter.com/willbradley">@willbradley</a></p>
</div>
</div>
</body>
</html>