Mini identity server that queries your router to find out who's in the office
Ruby CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib Cleanup mac address processing Mar 30, 2012
spec
.gitignore
.rspec Specdoc output for REPL Feb 17, 2012
.ruby-gemset
.ruby-version
.travis.yml Switch Travis coverage to 1.9.3 or newer Apr 21, 2013
Gemfile
Gemfile.lock Rake is always late to the party Feb 17, 2012
LICENSE Update the year for the copyright length Apr 21, 2013
README.md
Rakefile Add rake task for spec suite Feb 17, 2012
config.ru
snitch.coffee
snitch.example.yml Update example file Mar 30, 2012

README.md

Snitch

Mini identity server that queries your router to find out who's in the office

Build Status

Requirements

  • Ruby 2.0.0 (This app comes with a ruby-version and ruby-gemset just in case)
  • Airport Extreme/Express router that has SNMP Enabled

What is it for?

This was mainly built to support the original play app by Zach Holman where it was used to automatically queue favorite songs based on someone's presence in the office. You can also hook snitch up to your Hubot to see who is in the office.

How does it work?

This app uses SNMP to query your AirportExtreme for active DHCP Clients and returns ther MAC addresses via a web URL.

Special note about router configuration

Most Apple routers have 4 hours as the default DHCP lease timeout. Depending on the size of your office network. You may want to set the lease timeout to around 10 minutes to give a much more accurate response.

Getting started

First, setup your bundle

$ bundle

Make a copy of snitch.example.yml and rename it

cp snitch.example.yml snitch.yml

Edit the snitch.yml, update router_name and list out the MAC addresses (in lowercase) and github account/username of each user you want to track.

router_name: hal.local
"23:98:72:27:2e:88": martinisoft

Make sure SNMP is enabled on your AP Extreme/Express

Boot the server

rackup

Curl away!

curl http://localhost:9292/who

It should return a comma-delimited list of usernames, compatible with play

Hubot Script (optional)

Want to teach hubot how to talk to snitch? Load the snitch.coffee module into Hubot. Make sure you also load the github-credentials.coffee module from github-scripts, because it matches names from there.

License and Author

Copyright (C) 2012-2013 Aaron Kalin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.