Real Time Intrusion Detection System for IoT Networks using Random Forest

The project contains a full stack web app created with React front end and Django back end. It is an Intrusion Detection system which detects attacks in real time that occur within the IoT network in consideration.

Steps to install and run the application:

  1. Ensure you have python 3.6.9, node v12.16.0, npm 6.14.5, apache 2.4.29.

  2. Clone the repo and cd to be-project

cd be-project
  1. Create virtual environment for backend development
 virtualenv env
  1. Activate the virtual environment
 source env/bin/activate
  1. Install backend dependencies present in requirements.txt
 pip3 install -r requirements.txt
  1. Install frontend dependencies present in package.json
 npm i
  1. Build production folder of the front end
 npm run build
  1. Setup data base with backend
 python3 manage.py migrate
  1. Setup apache2 server – install apache2 or xampp and copy the ids folder in the web server directory. If you’ve installed xampp, you need to find the htdocs dir. If you’ve installed apache2, run this command from be-project dir.

cd be-project
sudo cp ids /var/www/html/ -r
  1. Run backend + build server
 python3 manage.py runserver 0.0.0.0:8000
  1. To Simulate the node (if actual node is not used)
 python3 home/node_simulator.py
  1. The shell script for tshark is in the home folder of be-project. Before you run it, you’ll have to replace s3rbeproj with your computer’s password.

 cd home
 ./tshark_shell_script.sh

Make sure the script has permissions to execute. If not, run

cd home
chmod -v +x tshark_shell_script.sh
  1. Kill all instances of tshark The shell script for kill_all_tshark is in the home folder of be-project. Before you run it, you’ll have to replace s3rbeproj with your computer’s password.

cd home
./kill_all_tshark.sh

Make sure the script has permissions to execute. If not, run

cd home
chmod -v +x kill_all_tshark.sh
  1. Testing

React Jest Testing

 npm test

Django Selenium Testing

 python3 manage.py test home.tests

For selenium testing, Make sure the script addGeckoToUsrBin has permissions to execute. If not, run

cd home
chmod -v +x addGeckoToUsrBin.sh

Important notes

For your own data collection please follow the steps specified in the Thesis , I’d suggest you to read theis completely before running the project.

TODO

Use standard dataset to train model , Decrease false positive rate

GitHub

View Github