You are on page 1of 50

INTELLIGENT INTRUSION DETECTION SYSTEM

MAJOR PROJECT REPORT

Submitted in partial fulfilment of the requirements for the award of the degree

of

BACHELOR OF TECHNOLOGY

in

INFORMATION TECHNOLOGY

by

Chaitanya Sagar Swati Dahiya Durga Puri Sidharth Dhamija


(01115603117) (03615603117) (40715603117) (35915603117)

Guided by

Mr. Jogendra Kumar


(Assistant Professor)

DEPARTMENT OF INFORMATION TECHNOLOGY


Dr. AKHILESH DAS GUPTA INSTITUTE OF TECHNOLOGY & MANAGEMENT
(AFFILIATED TO GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY, DELHI)
NEW DELHI – 110053
JULY 2021
INTELLIGENT INTRUSION DETECTION SYSTEM

MAJOR PROJECT REPORT

Submitted in partial fulfilment of the requirements for the award of the degree

of

BACHELOR OF TECHNOLOGY

in

INFORMATION TECHNOLOGY

by

Chaitanya Sagar Swati Dahiya Durga Puri Sidharth Dhamija


(01115603117) (03615603117) (40715603117) (35915603117)

Guided by

Mr. Jogendra Kumar


(Assistant Professor)

DEPARTMENT OF INFORMATION TECHNOLOGY


Dr. AKHILESH DAS GUPTA INSTITUTE OF TECHNOLOGY & MANAGEMENT
(AFFILIATED TO GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY, DELHI)
NEW DELHI – 110053
JULY 2021
CANDIDATE’S DECLARATION

It is hereby certified that the work which is being presented in the B. Tech Major Project
Report entitled “INTELLIGENT INTRUSION DETECTION SYSTEM” in partial
fulfilment of the requirements for the award of the degree of Bachelor of Technology and
submitted in the Department Of Information Technology of Dr. Akhilesh Das Gupta
Institute of Technology & Management, New Delhi (Affiliated to Guru Gobind Singh
Indraprastha University, Delhi) is an authentic record of our own work carried out during a
period from March 2021 to July 2021 under the guidance of Mr. Jogendra Kumar,
Assistant Professor.

The matter presented in the B. Tech Major Project Report has not been submitted by me for the
award of any other degree of this or any other Institute.

Chaitanya Sagar Swati Dahiya Durga Puri Sidharth Dhamija


(01115603117) (03615603117) (40715603117) (35915603117)

This is to certify that the above statement made by the candidate is correct to the best of my
knowledge. He/She/They are permitted to appear in the External Major Project Examination

Mr. Jogendra Kumar Prof. (Dr.) Prashant Singh


Assistant Professor Head, Department of IT

The B. Tech Minor Project Viva-Voce Examination of Chaitanya Sagar (01115603117),


Swati Dahiya (03615603117), Durga Puri (40715603117), Sidharth Dhamija
(35915603117), has been held on ……………………………….

Dr. Preeti Verma Dhaka

Mr. Ankit Aggarwal (Signature of External Examiner)


Project Coordinators
ABSTRACT

Physical surveillance is entirely dependent on humans and closed-circuit cameras. Various


recent instances have proven that current scheme of surveillance is not effective. Hence, there
is a need of a system that could automate entire surveillance and detect any intrusion.
Intelligent Intrusion Detection System (IIDS) is a system to detect physical intrusion in a
premise. System uses advanced Computer Vision techniques along with Machine Learning
algorithms to make decisions. Systems uses face detection scheme to identify intruders, uses
different encryption schemes to maintain data security and privacy.
ACKNOWLEDGEMENT

We express our deep gratitude to Mr, Jogendra Kumar, Designation, Department Of


Information Technology for his valuable guidance and suggestion throughout my project work.
We are thankful to Dr Preety Verma Dhaka and Mr. Ankit Aggarwal, Project Coordinators
for their valuable guidance.

We would like to extend my sincere thanks to Prof. (Dr.) Prashant Singh, Head of
Department, for his time to time suggestions to complete my project work. I am also thankful
to Prof. (Dr.) Sanjay Kumar, Director for providing me the facilities to carry out my project
work.

Signature Signature Signature Signature


Chaitanya Sagar Swati Dahiya Durga Puri Sidharth Dhamija
(01115603117) (03615603117) (40715603117) (35915603117)
TABLE OF CONTENTS

CANDIDATE DECLARATION i

ABSTRACT ii

ACKNOWLEDGEMENT iii

TABLE OF CONTENTS iv

LIST OF FIGURES v

LIST OF ABBREVIATIONS ix

Chapter 1: Introduction 1
Chapter 2: Literature Survey 2

Chapter 3: Project Features and Operations 4 – 18


3.1 WatchDog System 4
3.2 IIDS UI and Operations 5
3.3 Encryption Scheme 10
3.3.1 ASCIIMax Encryption Scheme 10
3.3.2 Login Credentials Encryption Scheme 11
3.3.3 ETBE Scheme 12
3.4 Email Information System 12
3.5 Logging Module 14
3.6 Face Recognition Model 15

3.7 Complete Workflow 17

Chapter 4: Result 19
Chapter 5: Conclusion 20
Appendix 21
References 22
LIST OF FIGURES

Figure 3.1 Fill the required details


Figure 3.2 Restart the access panel after updation of details
Figure 3.3 In access area
Figure 3.4 Logged Out
Figure 3.5 In access area
Figure 3.6 Live Feed
Figure 3.7 Log
Figure 3.8 ASCIIMax Encryption
Figure 3.9 ETBE Scheme
Figure 3.10 Current log mail sent
Figure 3.11 Intrusive Found
Figure 3.12 Activity done by intruder
Figure 3.13 Accuracy rate
Figure 3.14 Flow Chart
Figure 4.1 Accuracy rate
LIST OF ABBREVIATION

IIDS : Intelligent Intrusion Detection System


SRAM : Static Random Access Memory
DRAM : Dynamic Random Access Memory
UI : User Interface
CHAPTER 1: INTRODUCTION
___________________________________________________________

Rate of crime against enterprises and personal computing spaces is increasing at an


alarming rate. It can be either physical or digital in nature. Digital crimes are
prevented to a large extent by sophisticated software that prevents attacker from doing
any unwanted act. Whereas to prevent physical crimes, enterprises are still largely
dependent on human surveillance and monitoring. Intelligent Intrusion Detection
System (IIDS) uses computer vision and artificial intelligence techniques to monitor
each and every movement and also detect suspicious movements within time so that
necessary actions are taken.

IIDS is trained before deployment to recognize people. It detects each and activity and
informs its administrator through various methods about the suspicious activities. It
also keeps a record of every separately in the server done by recognized and
unrecognized person. This record can be used as a digital evidence in future.

Modern day security systems don't offer high security, they are basically footage
saving systems that record the footage of the scene and don't raise any alert messages
even if there is a threat or actual crime occurring. Authors have developed a system
that not only captures the footage but also detects any suspicious activity. This was
made possible by adding computer vision and neural network modules that will
process the live feed of the camera look for any possible threats and raise a security
alert message so that necessary action can be taken while the activity is being
performed.

System uses machine learning algorithms to recognize faces and making decisions on
whether person is an intruder or a trusted employee of the organization. Other features
of system include advanced asymmetric encryption schemes for data prevention,
email alert system for informing system administrator about significant activities,
logging mechanism to store information which may later be used as evidence in case
of any unfortunate incidents. Authors have also proposed extra features for further
releases of system, including sentiment analysis of intruder’s voice sample and speech
to text translation of intruder’s voice.

1
CHAPTER 2: LITERATURE REVIEW
___________________________________________________________

Authors have proposed a novel approach in [2] to design energy efficient processing
element for setting up convolutional neural network. Authors have used a
combination of fixed point and floating point representation thus achieving a tradeoff
in energy efficiency and expressing wide range of values. Proposed approach has
shown 47% efficiency in terms of power consumption and has occupied 16% less
area. The approach resulted in 54% less interaction between DRAM and SRAM with
only 3% loss in accuracy.

Authors in [3] have proposed an approach called Fuzzy Rough Cognitive Network.
Work claims that most of the neural network work like a black box while the ones
working at granular level, with practically zero performance loss. It also has proper
elucidation about selection of neurons at each level. Results have verified the
performance of proposed work.

This paper [4] discusses about the structuring of NN, made by clustering of neurons in
different layers. These neurons possess different functionality such as taking inputs,
processing these inputs in hidden layers and some are used for giving outputs. Author
also explains the methods to train the neural network such as Supervised training and
Unsupervised training.

A new approach of gesture recognition is proposed in [5] based on multi-layer NN.


This approach mainly follows four main steps namely 1. Gesture modeling 2.
Segmentation 3. Feature Extraction 4. Classification. Gesture modeling is used to
create vocabulary in accordance with the appropriate gesture. Segmentation is used to
extract the hand shape from the frames. After that Feature Extraction is used to
recognize the gestures and features.

In this paper [6] author has proposed a new approach to control urban traffic using
combination of neural network and collect traffic data. The author used improved
Elman neural network which are trained using back propagation algorithm, result
obtained from previous stage is mixed work has a great potential to handle and solve
problems related to urban traffic congestion, for an experimental data of 100 points
the maximum error found was 2 and average error is 0.77.

2
Authors have implemented an artificial NN in [7] to predict performance of a
sophomore enrolled in engineering. Certain factors were decided on the basis of
experience and were considered to predict the performance. Feed forward back
propagation algorithm is used for training this NN. The proposed approach gives an
accuracy of 84.6%.

In this paper [8] author proposed new method for facial recognition. The algorithm
used integrates principle component analysis, back propagation NN and discrete
cosine transformation. This approach helped to improve the performance of face
recognition, the normalization technique helps to reduce redundancy and PCA
reduces dimension. The propose method has mean square error of the order of 10-4

after 26th training iteration.

3
CHAPTER 3: PROJECT FEATURES AND OPERATION
___________________________________________________________

3.1 WATCHDOG SYSTEM

WatchDog is one of the core features of IIDS, it is responsible for the security of the
software, it makes sure that no one messes around with important files of the IIDS
system, if it finds out that an attempt to modify or delete the IIDS files has been done
then it send the admin an alert message regarding this issue and it automatically
corrects the files , if anyone tries to delete the file then this module will automatically
paste the correct copy of the file that needs to be there, Watchdog is basically a
temporary program that IIDS generates every time when the IIDS system is shut
down . After the system is turned off the program takes control of the files and makes
sure that they remain safe, when the IIDS system is turned on it kills the watchdog
program running in the background and destroys the old watchdog program files, as
the IIDS system will not be affected in any way if these files are deleted when the
system is on because the system will create those files anyway before shutting down,
these IIDS files are just needed to provide data to the system in order to initialize.

IIDS system stores the important files in the APPDATA directory of windows if
anyone manages to reach that directory and delete those files then the invisible
instance of watchdog will automatically add the removed files , the watchdog instance
cannot be traced in the task manager window as it runs in the background using VB
Script which makes it hidden and it given a different Name when it is operating so
that it cannot be traced using task finding commands , only IIDS core has the method
to destroy the instance hence ensuring high security. Watchdog broadly has 2 tasks,
first look for the presence of the important files and check the content of the important
files, if any of the check fails then it performs the needed action

To find out whether someone tried to delete the files IIDS system check the content of
the file as the watchdog system adds secret string in the end of the file which isn’t
visible through the text editor, when the IIDS core finds that extra added value then it
removes it and generates a high alert mail and sends it to the admin

4
3.2 IIDS UI AND OPERATION

The first screen that is visible after the user initializes the app is Login Screen after
adding the credentials and performing a successful login user gets access to the
Admin Panel which provides the user 3 main controls , first is to check the live
stream that IIDS is scanning, second is to check the Logs which IIDS is generating
after analyzing the video stream and third is add member control which allows the
user to add pictures of the objects or person that the user wants the system to
recognise as employee/object to be taken care of. The whole UI system is a tree
structure, Top is the main window node which displays everything and all the other
elements that are visible in the window are children of this node in some cases a UI
node can further have UI node as a child, as the user accesses different features of
IIDS these nodes are added and removed accordingly, fir example when the IIDS is
initialized the first screen has a TOP node with User ID text UI node and User ID
entry field UI as children along with other UI elements when the user logs in
successfully the system destroys all the nodes mentioned above and creates 4 Button
UI nodes which user authority to access the 3 features and shutdown system.

The tree system makes it easy to manage the layout of the app without making thing
much complicated and also reduces the memory overhead which might be created if
the elements nodes are just hidden instead of deleting them, memory overhead can
slow down system so this method helps in keeping the IIDS performance pretty
stable. Memory overhead elimination comes at the cost of slightly increased time due
to repeated allocation and deallocation of memory for the UI nodes but the time
increase is so less that it isn’t noticeable
UI elements present in the first page:
 3 Text UI nodes
 2 Text field UI nodes
 1 button UI node

5
Fig 3.1 Fill the required details

UI elements present in welcome page(visible only first time when user has to enter the
login detail and email ID to login nextime)
 4 text UI nodes
 3 text field UI nodes
 1 button UI node

Fig 3.2 Restart the access panel after updation of details

6
After the user enters the login credentials for the first time the user is redirected to
restart page in which the user get a message that the user data is saved and for the new
login credentials to take effect the user has to restart the app this page has
 1 text UI node
 1 button UI node

Fig 3.3 In access area

After restarting the app the user needs to enter the new login credentials else an error
message will be displayed the error message panel consist of following elements
 Panel UI node
 Message UI node
 Button UI node

7
Fig 3.4 Logged Out

The message UI node and button UI node are children of Panel node.
If the user enters the correct login credentials the user directed to Admin control
panel, this panel has the following UI nodes
 1 text UI node
 4 button UI nodes

Fig 3.5 In access area

8
The four button help user in operating the system, the button are:
 Watch Live stream button, this open up the live stream that is being captured
by the IIDS system if the debugger mode is on the sub stages of Live stream
analysis are also get shown

Fig 3.6 Live Feed

 View logs button this opens up a panel with the logs that are being generated
by the IIDS system

9
Fig 3.7 Log

 Add Member button, this helps the user to take 100 pictures of the employee
or object that user wants IIDS to keep a track of, after taking 100 pictures the
system automatically starts training itself so that IIDS core starts identifying
that particular object or person

3.3 ENCRYPTION SCHEME

There are three different encryption schemes used at different levels of project.
Encryption was required in order to hide important confidential data like the User
Name, Password, User Email ID and activity logs. Different encryption algorithms are
described below:

3.3.1 ASCIIMax Encryption Scheme: In this encryption scheme the string that has
to be encrypted is taken and ASCII value of each character in the string is compared
in order to obtain maximum ASCII value. Then all the characters are converted into
their respective ASCII codes these ASCII codes are later divided by the maximum
ASCII value obtained in the previous stage, the list of floats so generated constitute
the part of encrypted message the value of these floats is in the range of 0 to 1 , now
to decrypt this text the maximum ASCII value is needed this value is hidden in the
form of float value along with the float list that was generated by previous process,

10
here’s an example of how the maximum ASCII value is hidden in the form of float
value.

Let’s say that maximum ASCII value is 220 then to hide this value some random
value is added to this ASCII value say, 650 now the new value is 870, to make it look
like other float values a random float value is concatenated before this value which is
generated by random function, let’s say that the random function generated a value
“0.897” the final value will be “0.897870” , while decrypting the decrypter will
remove the extra value added by random function and them subtract 650 form the
value obtained to get the maximum ASCII value which is 22 in this case and then to
obtain the string all floats will be multiplied by this ASCII value to obtain the ASCII
values of all the characters in the string and finally these ASCII values will be
converted to corresponding characters. Since this is a new encryption scheme the
attacker will have no idea about what do the float values means and even if the
attacker figures out the scheme it will be hard to find out the float value which has the
hidden ASCII value and cracking the ASCII value from the float value is also not
easy as it has a random number added to it and an random float number concatenated
to itself.

Fig 3.8 ASCIIMax Encryption

3.3.2 Login Credentials Encryption: To encrypt the login credentials passlib library
was used , it helps in generating hashes , the user ID and password were repeated
hashed for 20 million times and a salt was also added to make hacking of the user
credentials difficult, to login the user enters the Login credentials which are then
compared to the hash values generated initially , passlib provides a provision just to
compare the two values and does not convert the hash back to user credential to
compare the entered value, this is done in order to avoid leaving any kind of trace

11
which can be used a security breach point, the hashing method used is SHA256, it
generates 256 bit hashes which more difficult to crack and on top of that he the high
iteration count makes it nearly impossible for the attacker to break the code and gain
access of the system.

3.3.3 ETBE scheme: ETBE scheme stands for Extended Text Base64 Encryption
scheme. This encryption scheme is followed to encrypt the system logs. It is an
asymmetric encryption scheme i.e. it encrypts the same text and gives a different
cipher text for it. The major advantage with this encryption scheme is that it becomes
extremely difficult for any attacker to reverse encryption scheme and understand the
actual message if it is not intended for that user. Encryption scheme adds two random
character strings both at the beginning and ending of actual string in to increase
string’s length and then encrypts it using open ssl base64 encryption. This way it
becomes extremely difficult to break encryption scheme and understand the actual
mechanism. This scheme is used to encrypt all system logs stored. This step increases
the data security and its privacy making system even more reliable.

Fig 3.9 ETBE Scheme

3.4 EMAIL INFORMATION SYSTEM

Project uses email as medium for sending system related information. It sends all the
necessary information to keep the system administrator posted about the working of
system. The system sends information through email in three conditions:

i. First condition is when an intruder enters the area of surveillance, system


decides on the basis of its learning if the person is an intruder or a trusted
personnel. In case of a trusted personnel information is logged for future usage
and in case the person is identified as an intruder then system generates an

12
email mentioning that an intruder entered premises and it also attaches the
image of that intruder for purpose of evidence and necessary course of action.
ii. Second condition is when system is closed or shut down, since the nature of
system is that of a surveillance system it is never meant to be closed and if
goes down or someone tries to shut it down deliberately then system
administrator must be informed. In this case email informs system
administrator that system went offline and it attaches a snapshot of system
logs with the email for evidence and necessary course of action. This entire
log is encrypted in asymmetric encryption scheme and is decrypted just before
sending the email. Traces of decryption are immediately removed from the
system for enhancement of overall system security.
iii. Third condition is when a malicious user tries to intentionally remove system
files. This is one of the high alert situation and it needs immediate supervision
so system administrator is informed about the same so that it could be dealt
with and in the meanwhile malicious user is not allowed to access that content.

Fig 3.10 Current log mail sent

13
Fig 3.11 Intrusive Found

Fig 3.12 Activity done by intruder

3.5 LOGGING MODULE

Logging module is another important aspect of system. Every important system


activity is logged and saved in the logging module. This module keeps track of a wide
range of activities like:
i. System boot timestamp, which basically tells the timestamp at which the
system was activated.
ii. Timestamp when intruder was seen in the premises for the first time, it
basically is the timestamp when intruder is seen in front of the camera for the
very first time.
iii. Timestamp when intruder’s image was captured by the system.
iv. Information about intruder if his image was captured or not. This is helpful in
cases if the image gets deleted accidentally.

14
v. Decision output if the person entering the premises is an intruder or a trusted
personnel, this is done on the basis of a machine learning algorithm that can
recognise faces.
vi. Timestamp of the information email if the person is identified as an intruder
and if it was sent or not to system administrator.
vii. Timestamp if the system is closed or shut down.

Logging module uses end to end encryption which is asymmetric in nature to enhance
the data security and its privacy. Data stored in the log module uses Sql structure and
syntax which provides freedom of cross platform operability. Events in logging
module are broadly categorized into:
i. High Priority Events
ii. Low Priority Events
This categorization is done on the basis of events that can or cannot affect system’s
working. Events like deletion of files can pose a serious threat to system and they
need immediate attention so they are placed in high priority events whereas activities
like system initialization are not that bigger threat.

3.6 FACE RECOGNITION MODULE

This is the most critical module of the entire system. This module decides if the
person entering the premises is a trusted individual or some malicious intruder. This is
achieved by using Computer Vision APIs like TensorFlow. System is trained to
recognise faces of people for which it is trained. The entire working mechanism of
this algorithm is explained below:

i. Training is the first step in the face recognition module. Module is fetched a
huge dataset of facial images of target faces which are to be recognised by the
system. This dataset serves as the knowledge for the module to understand the
faces better.
ii. On the basis of this training data, system creates a graph of all the values and
of the data extracted. This data is then used to further test and then identify
image or classify them.

15
iii. Testing is the next step after training, in this step it uses the graph obtained
from training and uses it to validate certain data and their corresponding
labels. System has shown a training efficiency of 92% and testing efficiency
of 95%. It was trained for 500 steps of training and testing cycles and over a
few thousand of images.

This module judges an image on labels for which model is trained. It predicts a
probability score along with the prediction of labels for every image being classified.
It then passes the predicted label to the email information module which then
proceeds with further steps.

Fig 3.13 Accuracy rate

16
3.7 COMPLETE WORKFLOW

Fig 3.14 Flow Chart

As Explained above there are various modules in IIDS that work together in order to
provide the security, the Fig. Shows the basic workflow of IIDS when the application
file is executed it first creates a window to display the UI elements and simultaneous
import all the essential libraries required for IIDS to work, then once this basic setup
is completed , it prompts the user to enter the login credentials, if the entered
credentials are correct then it moves on to check the next condition, whether the user
is logging in for the first time, if the answer to this condition is yes then it redirects
the user to a page where in it prompts user to enter the new User ID and Password and
the Email ID to which the logs have to be sent, once the details are filled it saves
those details in the encrypted form as redirects the user to restart page, which gives
user a confirmation message that everything went fine now IIDS will work according
to new login details but for those new settings to take effect the app has to be
restarted, Default user ID and password for the first time login is "root" and "toor"
respectively, these cannot be used as permanent login credentials.

When the user logs in next time with the new details it gives access to the Admin
Panel which is the core IIDS, this core continuously keeps track of user activity just to
find out when user presses a key or moves the mouse pointer, and according to

17
relevant gestures the panel performs actions, the Admin panels is very user friendly as
all operations can be performed by clicking a button.

There are 3 main facilities that are provided in the panel, one allows user to check the
live feed, other to check the logs which IIDS generates while analyzing the feed and
the last one to add a member , this helps IIDS in getting trained to identify a new user
or an object, and according to what it is IIDS keeps a track of it's motion in the
viewport that is seen from the camera, on finding anything suspicious it generates a
log and sends an alert message to the user, and finally there is an exit button which
shuts down the IIDS core first and initialises the watchdog instance to care of
important IIDS files when IIDS is not running and then sends logs to the user as a
backup and then shutdown itself completely, the watchdog takes care of everything
until IIDS is turned on next time for monitoring the feed. IIDS makes sure to destroy
the watchdog while initialising to avoid conflicts between itself and watchdog system
as the watchdog does not allow anyone to alter or delete the IIDS files.

18
The Chapter 4: RESULT
___________________________________________________________

IIDS passed all the basic and extreme situation tests, the first test was to see how well
it protects the User’s details and Log, since IIDS uses various encryption algorithms
and many of them are newly created algorithms which are hard to crack it becomes
nearly impossible for the attacker to collect any data , the second test was to check the
ability to handle attack on core features, and as results show that IIDS was able to to
handle any kind of attack on it’s core files that it needs in order to operate as there is a
background program “WatchDog” that takes care of all the files and just in case any
file gets deleted the program creates a new copy of the files and also makes sure to
introduce a special character which is used later on to detect an attack attempt, in such
a situation the software also intimates the admin about such activities.

Fig 4.1 Accuracy rate

The third test was to see whether the system is able to analyze the feed that it’s
capturing via webcam, results show that it was able to identify objects in the visible
in the viewport and on the basis of activities of the objects it was also able to detect
suspicious activities, which is the objective of the project, the system also generates
logs on the basis of its analysis of feed and it also keeps intimating the Admin about
the logs on regular get basis. The system was also highly adaptive as it easily gets
trained to identify new objects and people and does not get fooled by minor changes
in the facial features like length of the hair including facial hair.

19
Chapter 5: CONCLUSION

___________________________________________________________

All the decided targets were met in the given time and all the features of this project
stand upto the expectations, this project has a very good potential use in any industry
that is currently dependent on human surveillance as it can safely replace all the
human labour as it over all performance is greater and the cost of operation is really
low and the only possible expenditure is maintenance cost. This system can run 24 x 7
without fatigue which is the main cause of failure of human surveillance method.
However there is still scope of improvement in this which we plan to add in the
upcoming updates of this project. Features that will be added in the future updates are
sentiment analysis of the audio stream to find out the intentions of the person and
adding compatibility for depth sensors camera and night vision cameras which will
improve the performance of this system by many folds

20
APPENDIX
___________________________________________________________

login.py

#! /usr/bin/env python
#
# GUI module generated by PAGE version 4.10
# In conjunction with Tcl version 8.6
# Feb 11, 2018 12:22:23 PM
import ExtraProtection
import sys
import backend
#to fix Linux / Mac OS compatibility issue
import platform
from emailsend import emailsend
from threading import Thread
from datetime import datetime as dt
import os,time
#to fix Linux / Mac OS compatibility issue
import getpass
from CreateFiles import new_user
import label_image
import Email_encrypt_decrypt
#PLEASE note that you need to install the passlib library "pip(3) install passlib"
from passlib.hash import pbkdf2_sha256
import cv2, time, pandas
#to fix compatibility issues with Linux based systems or some other systems with
better graphical capabilities
import numpy as np
import speech_recognition as sr
from textblob import TextBlob

21
from audio import voice_analysis,get_emotion
import queue
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
import Login_support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root, path
flag = 0
#to fix Linux / Mac OS compatibility issue
path = ""
if(platform.system() == 'Windows'):
path = os.environ['APPDATA']
elif(platform.system() == 'Linux'):
path = os.path.expanduser("~") + os.sep + ".local" + os.sep + "share" + os.sep
try:
os.mkdir(path+ os.sep +"IIDS")
new_user()
except FileExistsError:
pass
root = Tk()
top = New_Toplevel_1 (root)
Login_support.init(root, top)
root.mainloop()
w = None
def create_New_Toplevel_1(root, *args, **kwargs):

22
'''Starting point when module is imported by another program.'''
global w, w_win, rt
rt = root
w = Toplevel (root)
top = New_Toplevel_1 (w)
Login_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_New_Toplevel_1():
global w
w.destroy()
w = None

class New_Toplevel_1:
#get values of UserID , AdminPassword and AdminEmailID
#to fix Linux / Mac OS compatibility issue
global path
global currentAdminEmailHash
if(platform.system() == 'Windows'):
path = os.environ['APPDATA']
elif(platform.system() == 'Linux'):
path = os.path.expanduser("~") + os.sep + ".local" + os.sep + "share" + os.sep
try:
os.mkdir(path+ os.sep +"IIDS")
new_user()
except FileExistsError:
pass
HighAlert = False
fo = open(path+ os.sep +"IIDS"+ os.sep +"u001.iidsfile", "r")
currentAdminNameHash = fo.read()
fo.close()
#fixed an issue that was caused by files created by bat file
if(currentAdminNameHash[len(currentAdminNameHash) - 1] == "\n"):
currentAdminNameHash =
currentAdminNameHash[:len(currentAdminNameHash) - 1]

23
fo = open(path+ os.sep +"IIDS"+ os.sep +"u001.iidsfile", "w")
fo.write(currentAdminNameHash)
fo.close()
HighAlert = True
fo = open(path+ os.sep +"IIDS"+ os.sep +"u002.iidsfile", "r")
currentAdminPassHash = fo.read()
fo.close()
#fixed an issue that was caused by files created by bat file
if(currentAdminPassHash[len(currentAdminPassHash) - 1] == "\n"):
currentAdminPassHash =
currentAdminPassHash[:len(currentAdminPassHash) - 1]
fo = open(path+ os.sep +"IIDS"+ os.sep +"u002.iidsfile", "w")
fo.write(currentAdminPassHash)
fo.close()
HighAlert = True
with open(path+ os.sep +"IIDS"+ os.sep +"u003.iidsfile", "r") as fo:
currentAdminEmailHash = fo.read().splitlines()
fo.close()
#fixed an issue that was caused by files created by bat file
if(currentAdminEmailHash[len(currentAdminEmailHash) - 1] == "ECHO is
off." or currentAdminEmailHash[len(currentAdminEmailHash) - 1] == " "):
currentAdminEmailHash =
currentAdminEmailHash[:len(currentAdminEmailHash) - 1]
fo = open(path+ os.sep +"IIDS"+ os.sep +"u003.iidsfile", "w")
for item in currentAdminEmailHash:
fo.write("%s\n" % item)
fo.close()
HighAlert = True
if HighAlert:
try:
t = Thread(target=emailsend,
args=(Email_encrypt_decrypt.decrypt(currentAdminEmailHash),
"HIGH ALERT SITUATION!!",
"An intruder tried to delete IIDS files!!","no"))

24
t.start()
backend.add_activity(str(dt.now()),"email regarding attempt to delete IIDS
files sent!","high")
except:
backend.add_activity(str(dt.now()),"email regarding attempt to delete IIDS
files couldn't be sent! ","high")
HighAlert = False
#print(currentAdminEmailHash)
#print(Email_encrypt_decrypt.decrypt(currentAdminEmailHash))

def Feed(self):

backend.add_activity(str(dt.now()),"System initialized","low")
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
first_frame=None
status_list=[None,None]
times=[]
df=pandas.DataFrame(columns=["Start","End"])
video=cv2.VideoCapture(0)
while True:
check, frame = video.read()
status=0
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
gray=cv2.GaussianBlur(gray,(21,21),0)
if first_frame is None:
first_frame=gray
continue
delta_frame=cv2.absdiff(first_frame,gray)
thresh_frame=cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)
[1]
thresh_frame=cv2.dilate(thresh_frame, None, iterations=2)
(_,cnts,_)=cv2.findContours(thresh_frame.copy(),cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
for contour in cnts:

25
if cv2.contourArea(contour) < 10000:
continue
status=1
(x, y, w, h)=cv2.boundingRect(contour)
#cv2.rectangle(frame, (x, y), (x+w, y+h), (0,255,0), 3)
status_list.append(status)
status_list=status_list[-2:]

if status_list[-1]==1 and status_list[-2]==0:


backend.add_activity(str(dt.now()),"a person entered premises","high")
cv2.imwrite(path+ os.sep +"IIDS"+ os.sep +"intruder.jpg",frame)
backend.add_activity(str(dt.now()),"person's image captured","high")
label = label_image.exe(path+ os.sep +"IIDS"+ os.sep +"intruder.jpg")
print(label[0])
if label[0] == "shivank" and float(label[1]) > 0.9:
backend.add_activity(str(dt.now()),"person identified as shivank","high")
elif label[0] == "ishtdeep" and float(label[1]) > 0.9:
backend.add_activity(str(dt.now()),"person identified as ishtdeep","high")
else:
label[0] = "intruder"
#queue = queue.Queue()
#q = Thread(target=voice_analysis)
#q.start()
#emotion = queue.get()
#print(emotion)
#print(get_emotion())
try:
t = Thread(target=emailsend,
args=(Email_encrypt_decrypt.decrypt(currentAdminEmailHash),
"Intruder Detected!",
"A person just entered in your premises who couldnot be identified. Person
seems to be "+label[0]+". Please find attachment",
path+ os.sep +"IIDS"+ os.sep +"intruder.jpg"))
t.start()

26
backend.add_activity(str(dt.now()),"email sent regarding intrusion
detected","high")
except:
backend.add_activity(str(dt.now()),"email couldn't be sent but an intrusion
Detected","high")
#emailsend("shivankawasthi.cse.msit@gmail.com",
#"Intrusion Detected!",
#"An intrusion was found in your premises. Please find attachment",
#"intruder.jpg")

if status_list[-1]==0 and status_list[-2]==1:


backend.add_activity(str(dt.now()),"motion stopped","high")

#cv2.imshow("Gray Frame",gray)
#cv2.imshow("Delta Frame",delta_frame)
#cv2.imshow("Threshold Frame",thresh_frame)
cv2.imshow("IIDS Live Feed",frame)
key=cv2.waitKey(1)
if key==ord('q'):
if status==1:
backend.add_activity(str(dt.now()),"System execution stopped","high")
break
#print(status_list)
#print(times)
#for i in range(0,len(times),2):
#df=df.append({"Start":times[i],"End":times[i+1]},ignore_index=True)
#df.to_csv("Times.csv")
video.release()
cv2.destroyAllWindows
def Destroy(self, top = None):
self.Canvas2.destroy()
self.Button7.destroy()
self.Label9.destroy()
self.Listbox1.destroy()

27
def Listbox(self, top = None):
font12 = "TkDefaultFont"
self.Canvas2 = Canvas(top)
self.Canvas2.place(relx=0.03, rely=0.04, relheight=0.94, relwidth=0.94)
self.Canvas2.configure(background="#1e1e1e")
self.Canvas2.configure(borderwidth="2")
self.Canvas2.configure(relief=RIDGE)
self.Canvas2.configure(selectbackground="#1e1e1e")
self.Canvas2.configure(width=701)
self.Button7 = Button(self.Canvas2)
self.Button7.place(relx=0.81, rely=0.86, height=36, width=107)
self.Button7.configure(activebackground="#d9d9d9")
self.Button7.configure(background="#646464")
self.Button7.configure(font=font12)
self.Button7.configure(foreground="#d9d9d9")
self.Button7.configure(text='''Back''')
self.Button7.configure(width=107)
self.Button7.configure(command = self.Destroy)
self.Label9 = Label(self.Canvas2)
self.Label9.place(relx=0.41, rely=0.02, height=48, width=136)
self.Label9.configure(background="#1e1e1e")
self.Label9.configure(font=font12)
self.Label9.configure(foreground="#d9d9d9")
self.Label9.configure(text='''Log''')
self.Label9.configure(width=136)
self.Listbox1 = Listbox(self.Canvas2)
self.Listbox1.place(relx=0.04, rely=0.12, relheight=0.84, relwidth=0.75)
self.Listbox1.configure(background="white")
self.Listbox1.configure(font="font12")
self.Listbox1.configure(width=524)
i=1
for line in backend.find_activity_interface():
self.Listbox1.insert(i, line)
i=i+1

28
def func(self, top=None):
font12 = "TkDefaultFont"
font9 = "-family {URW Gothic L} -size 13 -weight normal -slant"  \
" roman -underline 0 -overstrike 0"
font10 = "-family {DejaVu Sans} -size 10 -weight normal -slant"  \
" roman -underline 0 -overstrike 0"
if pbkdf2_sha256.verify(self.Entry1.get(), self.currentAdminNameHash) and
pbkdf2_sha256.verify(self.Entry2.get(), self.currentAdminPassHash):
ExtraProtection.DestroyProtection()
tempstore1 = self.Entry1.get()
tempstore2 = self.Entry2.get()
self.Label1.destroy()
self.Label2.destroy()
self.Label3.destroy()
self.Label3.destroy()
self.Entry1.destroy()
self.Entry2.destroy()
self.Button1.destroy()
if tempstore1 == "root" or tempstore2 == "toor":
#ask to set new credentials
self.Label5 = Label(top)
self.Label5.place(relx=0.34, rely=0.02, height=38, width=266)
self.Label5.configure(activeforeground="#c8c8c8")
self.Label5.configure(background="#1e1e1e")
self.Label5.configure(font=font12)
self.Label5.configure(foreground="#c8c8c8")
self.Label5.configure(text='''Fill in the required details''')
self.Label5.configure(width=266)
self.Label6 = Label(top)
self.Label6.place(relx=0.13, rely=0.24, height=38, width=96)
self.Label6.configure(background="#1e1e1e")
self.Label6.configure(font=font12)
self.Label6.configure(foreground="#c8c8c8")
self.Label6.configure(highlightcolor="#c8c8c8")

29
self.Label6.configure(text='''User ID :''')
self.Label6.configure(width=96)
self.Label7 = Label(top)
self.Label7.place(relx=0.12, rely=0.4, height=38, width=156)
self.Label7.configure(background="#1e1e1e")
self.Label7.configure(font=font12)
self.Label7.configure(foreground="#c8c8c8")
self.Label7.configure(text='''New Password :''')
self.Label7.configure(width=156)
self.Label8 = Label(top)
self.Label8.place(relx=0.11, rely=0.56, height=38, width=126)
self.Label8.configure(background="#1e1e1e")
self.Label8.configure(font=font12)
self.Label8.configure(foreground="#c8c8c8")
self.Label8.configure(text='''Email ID:''')
self.Label8.configure(width=126)
self.Button6 = Button(top)
self.Button6.place(relx=0.79, rely=0.82, height=36, width=127)
self.Button6.configure(activebackground="#d9d9d9")
self.Button6.configure(background="#646464")
self.Button6.configure(font=font12)
self.Button6.configure(foreground="#c8c8c8")
self.Button6.configure(text='''Confirm''')
self.Button6.configure(width=127)
self.Button6.configure(command = self.ResetPassword_EnterEmailID)
self.Entry3 = Entry(top)
self.Entry3.place(relx=0.34, rely=0.24,height=30, relwidth=0.34)
self.Entry3.configure(background="white")
self.Entry3.configure(font="TkFixedFont")
self.Entry3.configure(width=256)
self.Entry4 = Entry(top)
self.Entry4.place(relx=0.34, rely=0.4,height=30, relwidth=0.34)
self.Entry4.configure(background="white")
self.Entry4.configure(font="TkFixedFont")

30
self.Entry4.configure(width=256)
self.Entry4.configure(show='*')
self.Entry5 = Entry(top)
self.Entry5.place(relx=0.34, rely=0.56,height=30, relwidth=0.34)
self.Entry5.configure(background="white")
self.Entry5.configure(font="TkFixedFont")
self.Entry5.configure(width=256)
else:
# if user has already changed the credentials don't prompt the user to change
them and show this
self.Label4 = Label(top)
self.Label4.place(relx=0.44, rely=0.02, height=27, width=109)
self.Label4.configure(background="#1e1e1e")
self.Label4.configure(font=font12)
self.Label4.configure(foreground="#c8c8c8")
self.Label4.configure(highlightbackground="#c8c8c8")
self.Label4.configure(highlightcolor="#c8c8c8")
self.Label4.configure(text='''Hello Admin!''')
self.Button3 = Button(top)
self.Button3.place(relx=0.42, rely=0.2, height=56, width=157)
self.Button3.configure(activebackground="#d9d9d9")
self.Button3.configure(background="#646464")
self.Button3.configure(font=font12)
self.Button3.configure(foreground="#c8c8c8")
self.Button3.configure(text='''Start Live Feed!''')
self.Button3.configure(width=157)
self.Button3.configure(command = self.Feed)
self.Button4 = Button(top)
self.Button4.place(relx=0.42, rely=0.36, height=56, width=157)
self.Button4.configure(activebackground="#d9d9d9")
self.Button4.configure(background="#646464")
self.Button4.configure(font=font12)
self.Button4.configure(foreground="#c8c8c8")
self.Button4.configure(text='''Check Log''')

31
self.Button4.configure(width=157)
self.Button4.configure(command = self.Listbox)
self.Button5 = Button(top)
self.Button5.place(relx=0.42, rely=0.51, height=56, width=157)
self.Button5.configure(activebackground="#d9d9d9")
self.Button5.configure(background="#646464")
self.Button5.configure(font=font12)
self.Button5.configure(foreground="#c8c8c8")
self.Button5.configure(text='''Add New Member''')
self.Button5.configure(width=157)
else:
self.Canvas1 = Canvas(top)
self.Canvas1.place(relx=0.23, rely=0.22, relheight=0.51, relwidth=0.58)
self.Canvas1.configure(background="#1e1e1e")
self.Canvas1.configure(borderwidth="2")
self.Canvas1.configure(highlightbackground="#1e1e1e")
self.Canvas1.configure(relief=GROOVE)
self.Canvas1.configure(selectbackground="#c4c4c4")
self.Canvas1.configure(width=431)
self.Message1 = Message(self.Canvas1)
self.Message1.place(relx=0.35, rely=0.39, relheight=0.13, relwidth=0.29)
self.Message1.configure(background="#1e1e1e")
self.Message1.configure(font=font9)
self.Message1.configure(foreground="#c8c8c8")
self.Message1.configure(text='''Login Failed!''')
self.Message1.configure(width=123)
self.Button2 = Button(self.Canvas1)
self.Button2.place(relx=0.77, rely=0.78, height=27, width=79)
self.Button2.configure(activebackground="#d9d9d9")
self.Button2.configure(background="#646464")
self.Button2.configure(font=font10)
self.Button2.configure(foreground="#c8c8c8")
self.Button2.configure(highlightbackground="#646464")
self.Button2.configure(text='''Try Again!''')

32
self.Button2.configure(command = self.Canvas1.destroy)
self.Button2.configure(width=79)
def ResetPassword_EnterEmailID(self, top = None):
font12 = "TkDefaultFont"
fo = open(path+ os.sep +"IIDS"+ os.sep +"u003.iidsfile", "w")
l = Email_encrypt_decrypt.encrypt(self.Entry5.get())
for item in l:
fo.write("%s\n" % item)
fo.close()
fo = open(path+ os.sep +"IIDS"+ os.sep +"u001.iidsfile", "w")
fo.write(pbkdf2_sha256.encrypt(self.Entry3.get(), rounds = 2000000, salt_size
= 16))
fo.close()
fo = open(path+ os.sep +"IIDS"+ os.sep +"u002.iidsfile", "w")
fo.write(pbkdf2_sha256.encrypt(self.Entry4.get(), rounds = 2000000, salt_size
= 16))
fo.close()
self.Label5.destroy()
self.Label6.destroy()
self.Label7.destroy()
self.Label8.destroy()
self.Button6.destroy()
self.Entry3.destroy()
self.Entry4.destroy()
self.Entry5.destroy()
self.Label9 = Label(top)
self.Label9.place(relx=0.28, rely=0.02, height=45, width= 320)
self.Label9.configure(activeforeground="#c8c8c8")
self.Label9.configure(background="#1e1e1e")
self.Label9.configure(font=font12)
self.Label9.configure(foreground="#c8c8c8")
self.Label9.configure(text='''Details Updated! Now restart to access panel
again''')
self.Label9.configure(width=266)

33
self.Button7 = Button(top)
self.Button7.place(relx=0.40, rely=0.36, height=56, width=157)
self.Button7.configure(activebackground="#d9d9d9")
self.Button7.configure(background="#646464")
self.Button7.configure(font=font12)
self.Button7.configure(foreground="#c8c8c8")
self.Button7.configure(text='''Exit!''')
self.Button7.configure(width=157)
self.Button7.configure(command = exit)

def __init__(self, top=None):


'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#d9d9d9' # X11 color: 'gray85'
font10 = "-family {URW Gothic L} -size 13 -weight normal " \
"-slant roman -underline 0 -overstrike 0"
font12 = "TkDefaultFont"
font9 = "-family {DejaVu Sans} -size 10 -weight normal -slant " \
"roman -underline 0 -overstrike 0"
#to fix Linux / Mac OS compatibility issue
path = ""
if(platform.system() == 'Windows'):
path = os.environ['APPDATA']
elif(platform.system() == 'Linux'):
path = os.path.expanduser("~") + os.sep + ".local" + os.sep + "share" + os.sep
try:
os.mkdir(path+ os.sep +"IIDS")
except FileExistsError:
pass
file = open(path+ os.sep +"IIDS"+ os.sep +"u004.txt",'r')

34
username = file.read()
#print(type(username))
try:
username = int(username)
except:
pass
file.close()
#print(type(username))
if username == 1 :
#print("hello")
#to fix Linux / Mac OS compatibility issue
if(platform.system() == 'Windows'):
username = os.environ['USERNAME']
elif(platform.system() == 'Linux'):
username = getpass.getuser();
ms = new_user()
file = open(path+ os.sep +"IIDS"+ os.sep +"u004.txt","w")
file.write(username)
file.close()
#print(ms)
top.geometry("745x450+343+56")
top.title("Intelligent Intrusion Detection System")
top.configure(background="#1e1e1e")
top.configure(highlightcolor="black")

self.Label1 = Label(top)
self.Label1.place(relx=0.19, rely=0.02, height=28, width=466)
self.Label1.configure(activebackground="#f9f9f9")
self.Label1.configure(background="#1e1e1e")
self.Label1.configure(font=font10)
self.Label1.configure(foreground="#c8c8c8")
self.Label1.configure(text='''Welcome to Intelligent Intrusion Detection
System''')
self.Label2 = Label(top)

35
self.Label2.place(relx=0.11, rely=0.27, height=28, width=116)
self.Label2.configure(activebackground="#f9f9f9")
self.Label2.configure(background="#1e1e1e")
self.Label2.configure(font="Font12")
self.Label2.configure(foreground="#c8c8c8")
self.Label2.configure(text='''User ID :''')
self.Entry1 = Entry(top)
self.Entry1.place(relx=0.3, rely=0.27,height=30, relwidth=0.33)
self.Entry1.configure(background="white")
self.Entry1.configure(font="TkFixedFont")
self.Entry1.configure(selectbackground="#c4c4c4")
self.Label3 = Label(top)
self.Label3.place(relx=0.13, rely=0.42, height=23, width=90)
self.Label3.configure(activebackground="#f9f9f9")
self.Label3.configure(background="#1e1e1e")
self.Label3.configure(font="FOnt12")
self.Label3.configure(foreground="#c8c8c8")
self.Label3.configure(text='''Password :''')
self.Entry2 = Entry(top,show='*')
self.Entry2.place(relx=0.3, rely=0.42,height=30, relwidth=0.33)
self.Entry2.configure(background="white")
self.Entry2.configure(font="TkFixedFont")
self.Entry2.configure(selectbackground="#c4c4c4")
self.Button1 = Button(top)
self.Button1.place(relx=0.79, rely=0.69, height=36, width=127)
self.Button1.configure(activebackground="#d9d9d9")
self.Button1.configure(background="#646464")
self.Button1.configure(font="Font12")
self.Button1.configure(foreground="#c8c8c8")
self.Button1.configure(state=ACTIVE)
self.Button1.configure(text='''Login''')
self.Button1.configure(command = self.func)

36
if __name__ == '__main__':
vp_start_gui()
try:
s = Thread(target=backend.send_logs, args=("high",))
s.start()
backend.add_activity(str(dt.now()),"Logs sent to admin","high")
except:
backend.add_activity(str(dt.now()),"Logs couldn't be sent","high")
finally:
ExtraProtection.CreateAndInitialiseProtection()
time.sleep(2)
ls = os.listdir(path+ os.sep +"IIDS")
for i in ls:
if i == "logs.txt":
os.remove(path+ os.sep +"IIDS"+ os.sep +"logs.txt")
else:
pass

Backend.py

# this is the backend of IIDS


import sqlite3
from datetime import datetime as dt
import base64
import platform
from emailsend import emailsend
import os
from Email_encrypt_decrypt import encryption, decryption,decrypt

def connect():
#to fix Linux / Mac OS compatibility issue
global path
path = ""
if(platform.system() == 'Windows'):

37
path = os.environ['APPDATA']
elif(platform.system() == 'Linux'):
path = os.path.expanduser("~") + os.sep + ".local" + os.sep + "share" + os.sep
try:
os.mkdir(path+ os.sep +"IIDS")
except FileExistsError:
pass
conn = sqlite3.connect(path+ os.sep +"IIDS"+ os.sep +"syslogs.db")
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS syslogs(date_time TEXT
PRIMARY KEY, message TEXT, priority TEXT)")
conn.commit()
conn.close()
def add_activity(date_time, message, priority):
connect()
conn = sqlite3.connect(path+ os.sep +"IIDS"+ os.sep +"syslogs.db")
cur = conn.cursor()
cur.execute("INSERT INTO syslogs VALUES(?,?,?)",
(encryption(date_time),encryption(message),priority))
conn.commit()
conn.close()
def find_activity(priority):
#altered this function so that it goes well with forntend
msg = []
connect()
conn = sqlite3.connect(path+ os.sep +"IIDS"+ os.sep +"syslogs.db")
cur = conn.cursor()
cur.execute("SELECT * FROM syslogs WHERE priority=?",(priority,))
rows = cur.fetchall()
conn.commit()
conn.close()
msg = decode(rows)
return msg

38
def decode(rows):
#altered this function so that it goes well with forntend
message = []
for row in rows:
message.append(decryption(row[0]))
message.append(decryption(row[1]))
#print(str(base64.b64decode(row[0])))
#print(str(base64.b64decode(row[1])))
return message

def find_activity_interface():
#altered this function so that it goes well with forntend
finalMessage1 = []
finalMessage2 = []
#print("High priority events")
finalMessage1 = find_activity("high")
finalMessage1.insert(0,"HIGH PRIORITY EVENTS!!")
if(len(finalMessage1) == 1):
finalMessage1.append("NONE!")
#print("Low priority events")
finalMessage2 = find_activity("low")
finalMessage2.insert(0,"LOW PRIORITY EVENTS!!")
if(len(finalMessage2) == 1):
finalMessage2.append("NONE!")
return finalMessage1 + finalMessage2
def send_logs(priority):
connect()
conn = sqlite3.connect(path+ os.sep +"IIDS"+ os.sep +"syslogs.db")
cur = conn.cursor()
cur.execute("SELECT * FROM syslogs WHERE priority=?",(priority,))
rows = cur.fetchall()
conn.commit()
conn.close()
f = open(path+ os.sep +"IIDS"+ os.sep +"logs.txt",'w')

39
for row in rows:
f.write(decryption(row[0]))
f.write(decryption(row[1]))
f.write("\n")
f.close()
lines = []
with open(path+ os.sep +"IIDS"+ os.sep +"u003.iidsfile") as f:
lines = f.read().splitlines()
#fixed an issue that was caused by files created by bat file
if(lines[len(lines) - 1] == "ECHO is off." or lines[len(lines) - 1] == " "):
lines = lines[:len(lines) - 1]
emailsend(decrypt(lines),
"System logs!",
"Your system just went offline. We are sending you current system logs.
Please have a look asap.",
path+ os.sep +"IIDS"+ os.sep +"logs.txt")

40
REFERENCES

___________________________________________________________

[1] http://www.psych.utoronto.ca
[2] Y. Choi et. al., “Energy-efficient design of processing element for convolutional
neural network,” in IEEE Transactions on Circuits and Systems II: Express Briefs,
unpublished.
[3] G. Nápoles et. al., “Fuzzy-Rough Cognitive Networks,” in Neural Networks 97
(2018) 19 – 27, http://doi.org/10.10.16/j.neunet.2017.08.007.
[4] S.B. Maind and P. Wankar, “Research Paper on Basic of Artificial Neural Network,”
in International Journal on Recent and Innovation trends in Computing and
Communication, Vol.2, Issue 1, pp. 96-100, ISSN: 2321-8169.
[5] K. Arora, S. Suri, D. Arora and V. Pandey, “Gesture Recognition Using Artificial
Neural Network,” in Intenational Journal of Computer Science and Engineering, Vol.
2, Issue 4, E-ISSN: 2347-2693.
[6] Z. Zhou and K. Huang, “Research on a Combined Neural Networks Prediction Model
for Uran Traffic Volume,” in International Seminar on Future Biomedical
Information Engineering, DOI: 10.1109/FBIE.2008.15
[7] S. A. Naseer, I. Zaqout, M. A. Ghosh, R. Atallah and E. Alajrami, “Predicting
Student Performance Using Artificial Neural Network: in the Faculty of Engineering
and Information Technology,” in International Journal of Hybrid Information
Technology, Vol. 8, No. 2 (2015), pp. 221-228,
http://dx.doi.org/10.14257/ijhit.2015.8.2.20.
[8] A.E. Shivdas, “Face Recognition using Artificial Neural Network,” in International
Journal of Research in Management, Science and Technology, Vol. 2, No. 1, April
2014, E-ISSN: 2321-3264.
[9] Li Xiaodong et.al., “Widely Linear Quaternion Unscented Kalman Filter for
Quaternion-Valued Feedforward Neural Network” in IEEE Signal Processing Letters,
2017.
[10] WolfGang Maass, “Networks of Spiking Neurons: The Third Generation of Neural
Network Models”, Institute for Theoretical Computer Science, Austria, 2017.
[11] Abdelhalim Hiassat et. al., “A genetic algorithm approach for location-inventory-
routing problem with perishable products” in Journal of Manufacturing Systems,
2016, pp. 93-103.

41
[12] Stephen Grossberg, “Nonlinear Neural Networks: Principles, Mechanisms and
Architectures”, Neural Networks, Vol. 1, pp. 17-61, 1988.
[13] Xingbao Gao and Li-Zhi Liao, “A Novel Neural Network for Generally Constrained
Variational Inequalities” in IEEE Transactions on Neural Networks and Learning
Systems, 2016.
[14] Esteban J. Palomo et. al., “The Growing Hierarchical Neural Gas Self Organizing
Neural Network” in IEEE Transactions on Neural Networks and Learning Systems,
2016.
[15]Tsung-Yen Yang et.al., “Behavior-Based Grade Prediction for MOOCs via Time
Series Neural Networks” in IEEE Journal of Selected topics in signal Processing,
2016.
[16]Keke Gai et. al., “Cost-Aware Multimedia Data Allocation for Heterogeneous
Memory using Genetic Algorithm in Cloud Computing” in IEEE Transactions on
Cloud Computing, October 2015.
[17] Ramadoni Syahputra, “Distribution Network Optimization based on Genetic
Algorithms” in Journal of Electrical Technology UMY (JET-UMY), Vol. 1, No. 1,
March 2017.

42

You might also like