Skip to content
/ patrol Public

Ruby on Rails app to track when new devices join your network and send an email notification. Parses the XML output from Nmap and saves the entries to a local database. Intended to run on a Raspberry Pi to monitor the local network and alert when new devices are detected.

Notifications You must be signed in to change notification settings

hdaniel/patrol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patrol

Ruby on Rails app to track when new devices join your network and send an email notification.

Parses the XML output from Nmap and saves the entries to a local database. Intended to run on a Raspberry Pi to monitor the local network and alert when new devices are detected.

Setting up a Raspberry Pi:

To install:

After chruby is installed, add these lines to your ~/.bashrc:

source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
chruby 2.4.0
ruby-install ruby 2.4.0
chruby 2.4.0
  • Install bundler

gem install bundler

  • Install sqlite3
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
  • Install nmap

sudo apt-get install nmap

  • Clone the patrol repo and initialize it
git clone https://github.com/hdaniel/patrol.git
cd patrol; bundle install
bundle exec rake db:migrate
  • Configure your mail settings for notifications to go out. Edit config/environments/development.rb to add the correct SMTP settings for your mail server.

  • Edit /patrol/config/secrets.yml to add your email addresses and site name.

  • Add the nmap command to root's crontab

sudo crontab -e
# add this line correcting for your path and subnet:
00,15,30,45 * * * * nmap -oX /home/pi/patrol/public/nmap_output.xml -sP 192.168.2.*
  • Add the crontab entry to update the database and send alerts:
crontab -e
# add this line correcting for your path
05,20,35,50 * * * * $HOME/patrol/lib/bin/run_patrol.sh >/tmp/cron.log 2>&1

About

Ruby on Rails app to track when new devices join your network and send an email notification. Parses the XML output from Nmap and saves the entries to a local database. Intended to run on a Raspberry Pi to monitor the local network and alert when new devices are detected.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published