├── .gitignore ├── Aptfile ├── Procfile ├── README.md ├── Uploaded_files └── tempt.txt ├── app.js ├── cnn_binary_class.h5 ├── cnn_multi_class.h5 ├── fs_new validation project.csv ├── knn_binary_class.sav ├── knn_multi_class.sav ├── latest_cnn_bin.h5 ├── latest_cnn_multiclass.h5 ├── lstm_binary_class.h5 ├── lstm_latest_bin.h5 ├── lstm_latest_multiclass.h5 ├── lstm_multi_class.h5 ├── nids_csv_updated.py ├── nids_parameter_updated.py ├── nids_random_updated.py ├── package-lock.json ├── package.json ├── public └── css │ ├── boostrap-social.css │ ├── homeStyles.css │ ├── iphone6.png │ ├── sohail.jpg │ └── styles.css ├── randomRowPrediction ├── cnn_fs_bin.h5 ├── cnn_fs_multi.h5 ├── fs_new validation project.csv ├── knn_fs.sav ├── knn_fs_bin.sav ├── lstm_fs_bin_class.h5 ├── lstm_fs_multi_class.h5 ├── nids_random.py ├── randomfor_fs_bin.sav └── randomfor_fs_multi.sav ├── random_forest_binary_class.sav ├── random_forest_multi_class.sav ├── requirements.txt └── views ├── about.ejs ├── attacks.ejs ├── cnn_bin_table.ejs ├── cnn_table.ejs ├── features.ejs ├── home.ejs ├── knn_bin_table.ejs ├── knn_table.ejs ├── login.ejs ├── lstm_bin_table.ejs ├── lstm_table.ejs ├── parameters.ejs ├── paramsecrets.ejs ├── partials ├── footer.ejs ├── header.ejs ├── loadfoot.ejs └── loadhead.ejs ├── register.ejs ├── rf_bin_table.ejs ├── rf_table.ejs ├── secrets.ejs ├── secrets_2.ejs ├── stats.ejs └── submit.ejs /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env -------------------------------------------------------------------------------- /Aptfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/Aptfile -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node app.js -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Network-Intrusion-Detection-Using-Deep-Learning 2 | ## Objective : 3 | Cyber Security: Development of Network Intrusion Detection System (NIDS), with Machine Learning and Deep Learning, Recurrent Neural Network models, web I/O System. 4 | ## To run locally on your system: 5 | ### Method - 1 :- 6 | step-1: Keep the Docker Desktop and Docker Hub running parallelly on your system then open the command prompt or terminal and run the following command [docker run --publish 3000:3000 saif0786/nids]. 7 | 8 | step-2: You can now check the running of the service on your browser by typing [http://localhost:3000] as per shown above. 9 | 10 | ### Method - 2 :- 11 | Step-1 : Fork or Clone the project using command [git clone "https://github.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning"] 12 | Step-2 : Create a .env file and set up the dovenv variable which is used in app.js (or) remove dotenv variables from app.js and set the links like mongoDB link etc. 13 | Step-3 : Use command [npm install] to install all the packages. 14 | Step-4 : Use command [node app.js] to run it locally. 15 | ## Description : 16 | Large numbers of businesses were affected by data infringes and Cyber -attacks due to dependency on internet. To prevent such malicious activity, the network requires a system that detects anomaly and inform the user and alerts the user. 17 | 18 |  19 | 20 | This project detects Network Intrusion anomalies by using NSL - KDD data-set. The deep learning model Long Short Term Memory (LSTM), superior version of RNN (Recurrent Neural Network) and KNN K - Nearest Neighbour Algorithm) method are used for binary and multi class classification. 21 | 22 | The user enters the hacking parameters in the front end which is designed by using ReactJS. The model predicts the type of attack and gives information about the type of attack to the user. MongoDB is used for storing the data and NodeJS is served as back end framework. 23 | 24 | The project is fully responsive and completely based on session and cookies concepts. Once the user authenticated and logged-in It will not ask the user to enter the login parameters again and again (next visit). It ask login parameters only when user click on logout button. And also using google oauth 2.0 for user authentication and storing user details in salted hash in the mongoDB. 25 | 26 | ## Some Screenshots: 27 |  28 | 29 |  30 | 31 |  32 | 33 |  34 | 35 |  36 | 37 |  38 | 39 |  40 | 41 |  42 | 43 |  44 | 45 |  46 | 47 |  48 | 49 |  50 | 51 |  52 | 53 |  54 | 55 |  56 | 57 |  58 | 59 |  60 | 61 |  62 | 63 |  64 | 65 |  66 | 67 |  68 | 69 |  70 | 71 |  72 | 73 |  74 | 75 |  76 | 77 |  78 | 79 |  80 | 81 |  82 | 83 |  84 | 85 |  86 | 87 |  88 | -------------------------------------------------------------------------------- /Uploaded_files/tempt.txt: -------------------------------------------------------------------------------- 1 | temp 2 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //jshint esversion:6 2 | 3 | require('dotenv').config(); 4 | currentYear = new Date().getFullYear(); 5 | const { parse, stringify } = require('flatted'); 6 | let { PythonShell } = require('python-shell') 7 | const express = require("express"); 8 | var multer = require('multer'); 9 | const download = require('download'); 10 | const fs = require('fs'); 11 | const bodyParser = require("body-parser"); 12 | const ejs = require("ejs"); 13 | const mongoose = require("mongoose"); 14 | const cookieParser = require('cookie-parser'); 15 | const session = require('express-session'); 16 | const passport = require("passport"); 17 | const passportLocalMongoose = require("passport-local-mongoose"); 18 | var GoogleStrategy = require('passport-google-oauth20').Strategy; 19 | const findOrCreate = require('mongoose-findorcreate'); 20 | const app = express(); 21 | app.use(express.static("public")); 22 | app.set('view engine', 'ejs'); 23 | app.use(bodyParser.urlencoded({ 24 | extended: true 25 | })); 26 | app.use(session({ 27 | secret: "Our little secret.", 28 | resave: false, 29 | saveUninitialized: false 30 | })); 31 | app.use(passport.initialize()); 32 | app.use(passport.session()); 33 | app.use(cookieParser()); 34 | mongoose.connect(process.env.DB_LINK, { useNewUrlParser: true }).then(() => { 35 | console.log("database connected Successfully!!"); 36 | }).catch((err) => { 37 | console.log("database not connected!!"); 38 | console.log(err); 39 | }) 40 | 41 | const userSchema = new mongoose.Schema({ 42 | email: String, 43 | password: String, 44 | googleId: String, 45 | }); 46 | 47 | userSchema.plugin(passportLocalMongoose); 48 | userSchema.plugin(findOrCreate) 49 | 50 | const User = new mongoose.model("User", userSchema); 51 | 52 | passport.use(User.createStrategy()); 53 | 54 | passport.serializeUser(function (user, done) { 55 | done(null, user.id); 56 | }); 57 | passport.deserializeUser(function (id, done) { 58 | // User.findById(id, function (err, user) { 59 | // done(err, user); 60 | // }); 61 | // 62 | User.findById(id).then((err, user) => { 63 | done(err, id) 64 | }) 65 | }); 66 | // passport.use(new GoogleStrategy({ 67 | // clientID: process.env.CLIENT_ID, 68 | // clientSecret: process.env.CLIENT_SECRET, 69 | // callbackURL: process.env.CALL_BACK_URL, 70 | // userProfileUrl: process.env.URL 71 | // }, 72 | // async function (accessToken, refreshToken, profile, cb) { 73 | // try { 74 | // // Find the user 75 | // let user = await User.findOne({ googleId: profile.id }); 76 | 77 | // // If user doesn't exist, create a new one 78 | // if (!user) { 79 | // user = new User({ googleId: profile.id, username: profile.id }); 80 | // await user.save(); 81 | // } 82 | 83 | // // Return the user 84 | // return cb(null, user); 85 | // } catch (err) { 86 | // // If any error occurs, pass it to the callback 87 | // return cb(err); 88 | // } 89 | // })); 90 | 91 | 92 | submitted_csv_file = ""; 93 | var storage = multer.diskStorage({ 94 | destination: function (req, file, callback) { 95 | callback(null, './Uploaded_files'); 96 | }, 97 | filename: function (req, file, callback) { 98 | submitted_csv_file = file.originalname; 99 | console.log(submitted_csv_file); 100 | callback(null, file.originalname); 101 | } 102 | }); 103 | 104 | var upload = multer({ storage: storage }).single('myfile'); 105 | app.get("/", function (req, res) { 106 | res.render("home"); 107 | }); 108 | app.get("/secrets", function (req, res) { 109 | complete_answer = "" 110 | // knn 111 | knn_bin_cls = "" 112 | knn_mul_cls = "" 113 | knn_desc = "" 114 | knn_bin_acc = "0.9760368900303525" 115 | knn_mul_acc = "0.9740368900303525" 116 | // random forest 117 | rf_bin_cls = "" 118 | rf_mul_cls = "" 119 | rf_desc = "" 120 | rf_bin_acc = "0.9741029652113005" 121 | rf_mul_acc = "0.9731029652113005" 122 | // cnn 123 | cnn_bin_cls = "" 124 | cnn_mul_cls = "" 125 | cnn_desc = "" 126 | cnn_bin_acc = "0.9582535605883726" 127 | cnn_mul_acc = "0.9506420733130982" 128 | //lstm 129 | lstm_bin_cls = "" 130 | lstm_mul_cls = "" 131 | lstm_desc = "" 132 | lstm_bin_acc = "0.9562456222274107" 133 | lstm_mul_acc = "0.9590940929255195" 134 | 135 | res.render("secrets"); 136 | let options = { 137 | args: [] 138 | }; 139 | console.log("entering!!"); 140 | PythonShell.run('nids_random_updated.py', options, (err, response) => { 141 | if (err) 142 | console.log(err); 143 | if (response) { 144 | complete_answer = stringify(response); 145 | 146 | //knn 147 | temp_knn_bin_cls = stringify(response[0]); 148 | knn_bin_cls = temp_knn_bin_cls.slice(2, -2); 149 | 150 | temp_knn_mul_cls = stringify(response[1]); 151 | knn_mul_cls = temp_knn_mul_cls.slice(2, -2); 152 | 153 | temp_knn_desc = stringify(response[2]); 154 | knn_desc = temp_knn_desc.slice(2, -2); 155 | //random forest 156 | temp_rf_bin_cls = stringify(response[3]); 157 | rf_bin_cls = temp_rf_bin_cls.slice(2, -2); 158 | 159 | temp_rf_mul_cls = stringify(response[4]); 160 | rf_mul_cls = temp_rf_mul_cls.slice(2, -2); 161 | 162 | temp_rf_desc = stringify(response[5]); 163 | rf_desc = temp_rf_desc.slice(2, -2); 164 | //cnn 165 | temp_cnn_bin_cls = stringify(response[6]); 166 | cnn_bin_cls = temp_cnn_bin_cls.slice(2, -2); 167 | 168 | temp_cnn_mul_cls = stringify(response[7]); 169 | cnn_mul_cls = temp_cnn_mul_cls.slice(2, -2); 170 | 171 | temp_cnn_desc = stringify(response[8]); 172 | cnn_desc = temp_cnn_desc.slice(2, -2); 173 | //lstm 174 | temp_lstm_bin_cls = stringify(response[9]); 175 | lstm_bin_cls = temp_lstm_bin_cls.slice(2, -2); 176 | 177 | temp_lstm_mul_cls = stringify(response[10]); 178 | lstm_mul_cls = temp_lstm_mul_cls.slice(2, -2); 179 | 180 | temp_lstm_desc = stringify(response[11]); 181 | lstm_desc = temp_lstm_desc.slice(2, -2); 182 | console.log("entered!!"); 183 | /*var things=require('./views/secrets_2.ejs'); 184 | app.use('/secrets',things);*/ 185 | } 186 | }); 187 | }); 188 | //app.get() 189 | app.get("/secrets_2", function (req, res) { 190 | res.render("secrets_2"); 191 | }) 192 | app.get("/paramsecrets", function (req, res) { 193 | res.render("paramsecrets"); 194 | }) 195 | //if(l==final_ans){ 196 | p_complete_answer = "" 197 | // knn 198 | p_knn_bin_cls = "" 199 | p_knn_mul_cls = "" 200 | p_knn_desc = "" 201 | p_knn_bin_acc = "0.9760368900303525" 202 | p_knn_mul_acc = "0.9740368900303525" 203 | // random forest 204 | p_rf_bin_cls = "" 205 | p_rf_mul_cls = "" 206 | p_rf_desc = "" 207 | p_rf_bin_acc = "0.9741029652113005" 208 | p_rf_mul_acc = "0.9731029652113005" 209 | // cnn 210 | p_cnn_bin_cls = "" 211 | p_cnn_mul_cls = "" 212 | p_cnn_desc = "" 213 | p_cnn_bin_acc = "0.9582535605883726" 214 | p_cnn_mul_acc = "0.9506420733130982" 215 | //lstm 216 | p_lstm_bin_cls = "" 217 | p_lstm_mul_cls = "" 218 | p_lstm_desc = "" 219 | p_lstm_bin_acc = "0.9562456222274107" 220 | p_lstm_mul_acc = "0.9590940929255195" 221 | 222 | app.post("/parameters", function (req, res) { 223 | const submitted_protocol_type = req.body.protocol_type; 224 | const submitted_service = req.body.service; 225 | const submitted_flag = req.body.flag; 226 | const submitted_logged_in = req.body.logged_in; 227 | const submitted_count = req.body.count; 228 | const submitted_srv_serror_rate = req.body.srv_serror_rate; 229 | const submitted_srv_rerror_rate = req.body.srv_rerror_rate; 230 | const submitted_same_srv_rate = req.body.same_srv_rate; 231 | const submitted_diff_srv_rate = req.body.diff_srv_rate; 232 | const submitted_dst_host_count = req.body.dst_host_count; 233 | const submitted_dst_host_srv_count = req.body.dst_host_srv_count; 234 | const submitted_dst_host_same_srv_rate = req.body.dst_host_same_srv_rate; 235 | const submitted_dst_host_diff_srv_rate = req.body.dst_host_diff_srv_rate; 236 | const submitted_dst_host_same_src_port_rate = req.body.dst_host_same_src_port_rate; 237 | const submitted_dst_host_serror_rate = req.body.dst_host_serror_rate; 238 | const submitted_dst_host_rerror_rate = req.body.dst_host_rerror_rate; 239 | 240 | let options = { 241 | args: [submitted_protocol_type, submitted_service, submitted_flag, submitted_logged_in, submitted_count, submitted_srv_serror_rate, submitted_srv_rerror_rate, submitted_same_srv_rate, submitted_diff_srv_rate, submitted_dst_host_count, submitted_dst_host_srv_count, submitted_dst_host_same_srv_rate, submitted_dst_host_diff_srv_rate, submitted_dst_host_same_src_port_rate, submitted_dst_host_serror_rate, submitted_dst_host_rerror_rate] 242 | }; 243 | console.log("entering!!"); 244 | PythonShell.run('nids_parameter_updated.py', options, (err, response) => { 245 | if (err) 246 | console.log(err); 247 | if (response) { 248 | console.log("entered!!"); 249 | p_complete_answer = stringify(response); 250 | 251 | //knn 252 | p_temp_knn_bin_cls = stringify(response[0]); 253 | p_knn_bin_cls = p_temp_knn_bin_cls.slice(2, -2); 254 | 255 | p_temp_knn_mul_cls = stringify(response[1]); 256 | p_knn_mul_cls = p_temp_knn_mul_cls.slice(2, -2); 257 | 258 | p_temp_knn_desc = stringify(response[2]); 259 | p_knn_desc = p_temp_knn_desc.slice(2, -2); 260 | //random forest 261 | p_temp_rf_bin_cls = stringify(response[3]); 262 | p_rf_bin_cls = p_temp_rf_bin_cls.slice(2, -2); 263 | 264 | p_temp_rf_mul_cls = stringify(response[4]); 265 | p_rf_mul_cls = p_temp_rf_mul_cls.slice(2, -2); 266 | 267 | p_temp_rf_desc = stringify(response[5]); 268 | p_rf_desc = p_temp_rf_desc.slice(2, -2); 269 | //cnn 270 | p_temp_cnn_bin_cls = stringify(response[6]); 271 | p_cnn_bin_cls = p_temp_cnn_bin_cls.slice(2, -2); 272 | 273 | p_temp_cnn_mul_cls = stringify(response[7]); 274 | p_cnn_mul_cls = p_temp_cnn_mul_cls.slice(2, -2); 275 | 276 | p_temp_cnn_desc = stringify(response[8]); 277 | p_cnn_desc = p_temp_cnn_desc.slice(2, -2); 278 | //lstm 279 | p_temp_lstm_bin_cls = stringify(response[9]); 280 | p_lstm_bin_cls = p_temp_lstm_bin_cls.slice(2, -2); 281 | 282 | p_temp_lstm_mul_cls = stringify(response[10]); 283 | p_lstm_mul_cls = p_temp_lstm_mul_cls.slice(2, -2); 284 | 285 | p_temp_lstm_desc = stringify(response[11]); 286 | p_lstm_desc = p_temp_lstm_desc.slice(2, -2); 287 | } 288 | }); 289 | res.redirect("/paramsecrets"); 290 | }); 291 | app.get("/csv", function (req, res) { 292 | if (req.isAuthenticated()) { 293 | res.render("csv"); 294 | } else { 295 | res.redirect("/login"); 296 | } 297 | }); 298 | app.get('/csv', function (req, res) { 299 | res.sendFile(__dirname + "/csv"); 300 | }); 301 | 302 | final_ans = "" 303 | app.post('/uploadjavatpoint', function (req, res) { 304 | upload(req, res, function (err) { 305 | if (err) { 306 | return res.end("Error uploading file.") 307 | } 308 | res.end("File is uploaded successfully!"); 309 | console.log("hello"); 310 | const submitted_model = req.body.selected_model; 311 | console.log(submitted_model); 312 | console.log(submitted_csv_file); 313 | 314 | let options = { 315 | args: [submitted_model, submitted_csv_file] 316 | }; 317 | PythonShell.run('nids_csv_updated.py', options, (err, response) => { 318 | if (err) 319 | console.log(err); 320 | if (response) { 321 | temp_final_ans = stringify(response[0]); 322 | final_ans = temp_final_ans.slice(2, -2); 323 | console.log("completed"); 324 | } 325 | }) 326 | }) 327 | }); 328 | l = "completed!!" 329 | app.get('/index', (req, res) => { 330 | if (l == final_ans) { 331 | console.log("yes"); 332 | res.render('index'); 333 | } 334 | //console.log("entering"); 335 | 336 | }); 337 | app.get('/download-file', (req, res) => { 338 | console.log("entered"); 339 | path = './Uploaded_files/' 340 | path += submitted_csv_file; 341 | res.download(path); 342 | }); 343 | 344 | 345 | app.get("/features", function (req, res) { 346 | res.render("features"); 347 | }) 348 | app.get("/attacks", function (req, res) { 349 | res.render("attacks"); 350 | }) 351 | app.get("/about", function (req, res) { 352 | res.render("about"); 353 | }) 354 | app.get("/knn_bin_table", function (req, res) { 355 | res.render("knn_bin_table"); 356 | }); 357 | app.get("/rf_bin_table", function (req, res) { 358 | res.render("rf_bin_table"); 359 | }); 360 | app.get("/cnn_bin_table", function (req, res) { 361 | res.render("cnn_bin_table"); 362 | }); 363 | app.get("/lstm_bin_table", function (req, res) { 364 | res.render("lstm_bin_table"); 365 | }); 366 | app.get("/knn_table", function (req, res) { 367 | res.render("knn_table"); 368 | }); 369 | app.get("/rf_table", function (req, res) { 370 | res.render("rf_table"); 371 | }); 372 | app.get("/cnn_table", function (req, res) { 373 | res.render("cnn_table"); 374 | }); 375 | app.get("/lstm_table", function (req, res) { 376 | res.render("lstm_table"); 377 | }); 378 | app.get("/stats", function (req, res) { 379 | res.render("stats"); 380 | }); 381 | app.get("/parameters", function (req, res) { 382 | res.render("parameters"); 383 | }) 384 | app.get("/contact", function (req, res) { 385 | res.render("contact"); 386 | }) 387 | app.get('/auth/google', 388 | passport.authenticate('google', { 389 | scope: 390 | ['profile'] 391 | } 392 | )); 393 | app.get("/auth/google/NIDS", 394 | passport.authenticate('google', { failureRedirect: "/login" }), 395 | function (req, res) { 396 | res.redirect("/submit"); 397 | }); 398 | app.get("/login", function (req, res) { 399 | res.render("login"); 400 | }); 401 | 402 | // app.get("/login",passport.authenticate("lo")(req,res)=>{ 403 | 404 | // }) 405 | 406 | 407 | app.get("/register", function (req, res) { 408 | res.render("register"); 409 | }); 410 | app.get("/submit", function (req, res) { 411 | if (req.cookies?.user) { 412 | console.log( 413 | "entering!!" 414 | ) 415 | res.render("submit"); 416 | } else { 417 | console.log(req.cookies); 418 | res.redirect("/login"); 419 | } 420 | 421 | }); 422 | 423 | app.get("/logout", function (req, res, next) { 424 | req.logout(function (err) { 425 | if (err) { return next(err); } 426 | res.clearCookie("user"); 427 | res.redirect('/'); 428 | }); 429 | // res.redirect("/"); 430 | 431 | if (submitted_csv_file != "") { 432 | path = './Uploaded_files/' 433 | path += submitted_csv_file; 434 | fs.unlink(path, (err) => { 435 | if (err) { 436 | console.log(err); 437 | } 438 | console.log('file deleted'); 439 | submitted_csv_file = ""; 440 | }); 441 | } 442 | 443 | 444 | }); 445 | 446 | app.post("/register", function (req, res) { 447 | // User.register({username: req.body.username},req.body.password, function(err){ 448 | // if (err) { 449 | // console.log(err); 450 | // res.redirect("/register"); 451 | // } else { 452 | // passport.authenticate("local")(req, res, function(){ 453 | // res.redirect("/submit"); 454 | // }); 455 | // } 456 | // }); 457 | const user = new User({ 458 | username: req.body.username, 459 | password: req.body.password 460 | }) 461 | user.save().then(() => { 462 | // passport.authenticate("local").then(() => { 463 | res.redirect("/login") 464 | // }).catch((err) => { 465 | // console.log("error in passport"); 466 | // console.log(err); 467 | // res.redirect("/register"); 468 | // }) 469 | }).catch((err) => { 470 | console.log("error in register!!"); 471 | console.log(err); 472 | res.redirect("/register") 473 | }) 474 | }); 475 | 476 | app.post("/login", async function (req, res) { 477 | try { 478 | const user = new User({ 479 | username: req.body.username, 480 | password: req.body.password, 481 | }); 482 | 483 | const foundUser = await User.findOne({ username: req.body.username, password: req.body.password }); 484 | 485 | if (foundUser) { 486 | console.log(foundUser); 487 | res.cookie('user', foundUser.username, { maxAge: 900000, httpOnly: true }); 488 | res.redirect("/submit"); 489 | } else { 490 | res.status(401).send("Invalid credentials"); 491 | } 492 | } catch (err) { 493 | console.log(err); 494 | res.status(500).send("Internal Server Error"); 495 | } 496 | }); 497 | // req.login(user, function (err) { 498 | // if (err) { 499 | // console.log("error during login!!"); 500 | // console.log(err); 501 | // } else { 502 | // // passport.authenticate("local")(req, res, function () { 503 | // console.log("error"); 504 | // res.redirect("/submit"); 505 | // // }); 506 | // } 507 | // }); 508 | // }) 509 | 510 | // }); 511 | 512 | let port = process.env.PORT; 513 | if (port == null || port == "") { 514 | port = 3000; 515 | } 516 | app.listen(port, function () { 517 | console.log("Server started on port 3000."); 518 | }); -------------------------------------------------------------------------------- /cnn_binary_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/cnn_binary_class.h5 -------------------------------------------------------------------------------- /cnn_multi_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/cnn_multi_class.h5 -------------------------------------------------------------------------------- /knn_binary_class.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/knn_binary_class.sav -------------------------------------------------------------------------------- /knn_multi_class.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/knn_multi_class.sav -------------------------------------------------------------------------------- /latest_cnn_bin.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/latest_cnn_bin.h5 -------------------------------------------------------------------------------- /latest_cnn_multiclass.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/latest_cnn_multiclass.h5 -------------------------------------------------------------------------------- /lstm_binary_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/lstm_binary_class.h5 -------------------------------------------------------------------------------- /lstm_latest_bin.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/lstm_latest_bin.h5 -------------------------------------------------------------------------------- /lstm_latest_multiclass.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/lstm_latest_multiclass.h5 -------------------------------------------------------------------------------- /lstm_multi_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/lstm_multi_class.h5 -------------------------------------------------------------------------------- /nids_csv_updated.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | from sklearn.metrics import accuracy_score, confusion_matrix 4 | import pandas as pd 5 | from sklearn.preprocessing import LabelEncoder 6 | from sklearn.preprocessing import MinMaxScaler 7 | import sklearn 8 | from sklearn.neighbors import KNeighborsClassifier 9 | import os 10 | #from google.colab import drive 11 | from sklearn.preprocessing import LabelEncoder 12 | from sklearn.preprocessing import Normalizer 13 | import tensorflow as tf 14 | import pickle 15 | import os 16 | os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' 17 | 18 | #Uploaded_files\fs_test.csv 19 | path='Uploaded_files/' 20 | val=sys.argv[1] 21 | path+=sys.argv[2]; 22 | #path='/content/gdrive/My Drive/fs_test.csv' 23 | f=open(path) 24 | data_Validate=pd.read_csv(f) 25 | columns = (['protocol_type','service','flag','logged_in','count','srv_serror_rate','srv_rerror_rate','same_srv_rate','diff_srv_rate','dst_host_count','dst_host_srv_count','dst_host_same_srv_rate','dst_host_diff_srv_rate','dst_host_same_src_port_rate','dst_host_serror_rate','dst_host_rerror_rate']) 26 | data_Validate.columns=columns 27 | protocol_type_le = LabelEncoder() 28 | service_le = LabelEncoder() 29 | flag_le = LabelEncoder() 30 | data_Validate['protocol_type'] = protocol_type_le.fit_transform(data_Validate['protocol_type']) 31 | data_Validate['service'] = service_le.fit_transform(data_Validate['service']) 32 | data_Validate['flag'] = flag_le.fit_transform(data_Validate['flag']) 33 | df_validate=data_Validate.copy(deep=True) 34 | x_validate=df_validate.copy(deep=True) 35 | label_encoder = LabelEncoder() 36 | scaler=MinMaxScaler() 37 | x1=x_validate.copy(deep=True) 38 | scaler=MinMaxScaler() 39 | scaler.fit(x1) 40 | scaled_data=scaler.transform(x1) 41 | scaled_data=pd.DataFrame(scaled_data) 42 | scaled_data.columns= x1.columns 43 | x_validate=pd.DataFrame(scaled_data) 44 | print(x_validate.shape) 45 | if(val=='knn'): 46 | knn_bin = pickle.load(open('knn_binary_class.sav', 'rb')) 47 | knn_multi = pickle.load(open('knn_multi_class.sav', 'rb')) 48 | x_predict_bin=knn_bin.predict(x_validate) 49 | x_predict_multi=knn_multi.predict(x_validate) 50 | l=[] 51 | for i in x_predict_bin: 52 | if(i == 0): 53 | l.append('Normal') 54 | else: 55 | l.append('Attack') 56 | l=np.array(l) 57 | df_validate['binary class']=l 58 | df_validate['multi class']=x_predict_multi 59 | df_validate.to_csv(path,index=False) 60 | elif(val=='rf'): 61 | rf_bin = pickle.load(open('random_forest_binary_class.sav', 'rb')) 62 | rf_multi = pickle.load(open('random_forest_multi_class.sav', 'rb')) 63 | x_predict_bin=rf_bin.predict(x_validate) 64 | x_predict_multi=rf_multi.predict(x_validate) 65 | l=[] 66 | for i in x_predict_bin: 67 | if(i == 0): 68 | l.append('Normal') 69 | else: 70 | l.append('Attack') 71 | l=np.array(l) 72 | df_validate['binary class']=l 73 | df_validate['multi class']=x_predict_multi 74 | df_validate.to_csv(path,index=False) 75 | elif(val=='cnn'): 76 | x_validate=df_validate.iloc[:,0:16] 77 | scaler = Normalizer().fit(x_validate) 78 | x_validate = scaler.transform(x_validate) 79 | np.set_printoptions(precision=3) 80 | cnn_bin=tf.keras.models.load_model('latest_cnn_bin.h5') 81 | cnn_multi=tf.keras.models.load_model('latest_cnn_multiclass.h5') 82 | x_validate = np.reshape(x_validate, (x_validate.shape[0],1,x_validate.shape[1])) 83 | x_predict_bin=cnn_bin.predict(x_validate,verbose=False) 84 | x_validate=df_validate.iloc[:,0:16] 85 | scaler = Normalizer().fit(x_validate) 86 | x_validate = scaler.transform(x_validate) 87 | np.set_printoptions(precision=3) 88 | x_validate = np.reshape(x_validate, (x_validate.shape[0],x_validate.shape[1],1)) 89 | x_predict_multi=cnn_multi.predict(x_validate,verbose=False) 90 | l=[] 91 | l1=[] 92 | for i in x_predict_multi: 93 | te=[] 94 | for j in i: 95 | te.append(round(j)) 96 | l.append(te) 97 | res=[] 98 | for i in l: 99 | if(i[0]==1): 100 | res.append('Dos') 101 | elif(i[1]==1): 102 | res.append('Normal') 103 | elif(i[2]==1): 104 | res.append('Probe') 105 | elif(i[3]==1): 106 | res.append('R2L') 107 | elif(i[4]==1): 108 | res.append('U2R') 109 | else: 110 | res.append('Normal') 111 | l=np.array(res) 112 | l1=[] 113 | for i in x_predict_bin: 114 | for j in i: 115 | l1.append(round(j)) 116 | res=[] 117 | for i in l1: 118 | if(i==0): 119 | res.append('Normal') 120 | else: 121 | res.append('Attack') 122 | l1=np.array(res) 123 | df_validate['binary class']=l1 124 | print(l) 125 | df_validate['multi class']=l 126 | df_validate.to_csv(path,index=False) 127 | elif(val=='lstm'): 128 | lstm_bin=tf.keras.models.load_model('lstm_latest_bin.h5') 129 | lstm_multi=tf.keras.models.load_model('lstm_latest_multiclass.h5') 130 | x_validate=df_validate.iloc[:,0:16] 131 | scaler = Normalizer().fit(x_validate) 132 | x_validate = scaler.transform(x_validate) 133 | np.set_printoptions(precision=3) 134 | x_validate = np.reshape(x_validate, (x_validate.shape[0],1, x_validate.shape[1])) 135 | x_predict_bin=lstm_bin.predict(x_validate,verbose=False) 136 | x_predict_multi=lstm_multi.predict(x_validate,verbose=False) 137 | l=[] 138 | l1=[] 139 | for i in x_predict_multi: 140 | te=[] 141 | for j in i: 142 | te.append(round(j)) 143 | l.append(te) 144 | res=[] 145 | for i in l: 146 | if(i[0]==1): 147 | res.append('Dos') 148 | elif(i[1]==1): 149 | res.append('Normal') 150 | elif(i[2]==1): 151 | res.append('Probe') 152 | elif(i[3]==1): 153 | res.append('R2L') 154 | elif(i[4]==1): 155 | res.append('U2R') 156 | else: 157 | res.append('Normal') 158 | l=np.array(res) 159 | l1=[] 160 | for i in x_predict_bin: 161 | for j in i: 162 | l1.append(round(j)) 163 | res=[] 164 | for i in l1: 165 | if(i==0): 166 | res.append('Normal') 167 | else: 168 | res.append('Attack') 169 | l1=np.array(res) 170 | df_validate['binary class']=l1 171 | df_validate['multi class']=l 172 | df_validate.to_csv(path,index=False) 173 | print('completed') 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /nids_parameter_updated.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | from sklearn.metrics import accuracy_score, confusion_matrix 4 | import pandas as pd 5 | from sklearn.preprocessing import LabelEncoder 6 | from sklearn.preprocessing import MinMaxScaler 7 | import sklearn 8 | from sklearn.neighbors import KNeighborsClassifier 9 | import os 10 | from sklearn.preprocessing import LabelEncoder 11 | import tensorflow as tf 12 | import pickle 13 | from sklearn import preprocessing 14 | from sklearn.preprocessing import Normalizer 15 | import os 16 | os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' 17 | 18 | prot_type=sys.argv[1] 19 | service=sys.argv[2] 20 | flag=sys.argv[3] 21 | log_in=int(sys.argv[4]) 22 | count=int(sys.argv[5]) 23 | srv_serr_rate=float(sys.argv[6]) 24 | srv_rerr_rate=float(sys.argv[7]) 25 | sm_srv_rate=float(sys.argv[8]) 26 | diff_srv_rate=float(sys.argv[9]) 27 | dst_hst_count=int(sys.argv[10]) 28 | dst_hst_ser_count=int(sys.argv[11]) 29 | dst_hst_same_srv_count=float(sys.argv[12]) 30 | dst_hst_diff_srv_rate=float(sys.argv[13]) 31 | dst_hst_same_src_port_rate=float(sys.argv[14]) 32 | dst_hst_serr_rate=float(sys.argv[15]) 33 | dst_hst_rerr_rate=float(sys.argv[16]) 34 | 35 | prot_type_map={'tcp':1,'udp':2,'icmp':0} 36 | serv_type_map={'IRC': 0, 37 | 'X11': 1, 38 | 'Z39_50': 2, 39 | 'http_8001': 3, 40 | 'auth': 4, 41 | 'bgp': 5, 42 | 'courier': 6, 43 | 'csnet_ns': 7, 44 | 'ctf': 8, 45 | 'daytime': 9, 46 | 'discard': 10, 47 | 'domain': 11, 48 | 'domain_u': 12, 49 | 'echo': 13, 50 | 'eco_i': 14, 51 | 'ecr_i': 15, 52 | 'efs': 16, 53 | 'exec': 17, 54 | 'finger': 18, 55 | 'ftp': 19, 56 | 'ftp_data': 20, 57 | 'gopher': 21, 58 | 'harvest': 22, 59 | 'hostnames': 23, 60 | 'http': 24, 61 | 'http_2784': 25, 62 | 'http_443': 26, 63 | 'aol': 27, 64 | 'imap4': 28, 65 | 'iso_tsap': 29, 66 | 'klogin': 30, 67 | 'kshell': 31, 68 | 'ldap': 32, 69 | 'link': 33, 70 | 'login': 34, 71 | 'mtp': 35, 72 | 'name': 36, 73 | 'netbios_dgm': 37, 74 | 'netbios_ns': 38, 75 | 'netbios_ssn': 39, 76 | 'netstat': 40, 77 | 'nnsp': 41, 78 | 'nntp': 42, 79 | 'ntp_u': 43, 80 | 'other': 44, 81 | 'pm_dump': 45, 82 | 'pop_2': 46, 83 | 'pop_3': 47, 84 | 'printer': 48, 85 | 'private': 49, 86 | 'red_i': 50, 87 | 'remote_job': 51, 88 | 'rje': 52, 89 | 'shell': 53, 90 | 'smtp': 54, 91 | 'sql_net': 55, 92 | 'ssh': 56, 93 | 'sunrpc': 57, 94 | 'supdup': 58, 95 | 'systat': 59, 96 | 'telnet': 60, 97 | 'tftp_u': 61, 98 | 'tim_i': 62, 99 | 'time': 63, 100 | 'urh_i': 64, 101 | 'urp_i': 65, 102 | 'uucp': 66, 103 | 'uucp_path': 67, 104 | 'vmnet': 68, 105 | 'whois': 69} 106 | flag_type_map={'OTH': 0, 107 | 'REJ': 1, 108 | 'RSTO': 2, 109 | 'RSTOS0': 3, 110 | 'RSTR': 4, 111 | 'S0': 5, 112 | 'S1': 6, 113 | 'S2': 7, 114 | 'S3': 8, 115 | 'SF': 9, 116 | 'SH': 10} 117 | prot_type=prot_type_map.get(prot_type) 118 | service=serv_type_map.get(service) 119 | flag=flag_type_map.get(flag) 120 | l=[] 121 | l.append(prot_type) 122 | l.append(service) 123 | l.append(flag) 124 | l.append(log_in) 125 | l.append(count) 126 | l.append(srv_serr_rate) 127 | l.append(srv_rerr_rate) 128 | l.append(sm_srv_rate) 129 | l.append(diff_srv_rate) 130 | l.append(dst_hst_count) 131 | l.append(dst_hst_ser_count) 132 | l.append(dst_hst_same_srv_count) 133 | l.append(dst_hst_diff_srv_rate) 134 | l.append(dst_hst_same_src_port_rate) 135 | l.append(dst_hst_serr_rate) 136 | l.append(dst_hst_rerr_rate) 137 | l1 = preprocessing.normalize([l]) 138 | knn_bin = pickle.load(open('knn_binary_class.sav', 'rb')) 139 | knn_multi = pickle.load(open('knn_multi_class.sav', 'rb')) 140 | randfor_bin = pickle.load(open('random_forest_binary_class.sav', 'rb')) 141 | randfor_multi = pickle.load(open('random_forest_multi_class.sav', 'rb')) 142 | cnn_bin= tf.keras.models.load_model('latest_cnn_bin.h5') 143 | cnn_multi= tf.keras.models.load_model('latest_cnn_multiclass.h5') 144 | lstm_bin= tf.keras.models.load_model('lstm_latest_bin.h5') 145 | lstm_multi= tf.keras.models.load_model('lstm_latest_multiclass.h5') 146 | val_knn=knn_bin.predict(l1) 147 | if(val_knn[0]==0): 148 | print('KNN algorithm binary class:Normal') 149 | else: 150 | print('KNN algorithm binary class:Attack') 151 | #print('KNN Algorithm multi class:',knn_multi.predict(l1)) 152 | tp_knn=knn_multi.predict(l1) 153 | for i in tp_knn: 154 | tp_knn=i 155 | 156 | print('KNN Multi Class Type : ',tp_knn) 157 | if(tp_knn=='dos'): 158 | print('KNN Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 159 | elif(tp_knn=='probe'): 160 | print('KNN Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 161 | elif(tp_knn=='r2l'): 162 | print('KNN Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 163 | elif(tp_knn=='u2r'): 164 | print('KNN Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 165 | else: 166 | print('KNN Description : Data is safe') 167 | val_rnd=randfor_bin.predict(l1) 168 | if(val_rnd[0]==0): 169 | print('Random Forsest Algorithm Binary class:Normal') 170 | else: 171 | print('Random Forsest Algorithm Binary class:Attack') 172 | 173 | #print('Random Forsest Algorithm Multi class:',randfor_multi.predict(l1)) 174 | tp_randfor=randfor_multi.predict(l1) 175 | for i in tp_randfor: 176 | tp_randfor=i 177 | print('RANDOM FOREST Multi Class Type : ',tp_randfor) 178 | if(tp_randfor=='dos'): 179 | print('RANDOM FOREST Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 180 | elif(tp_randfor=='probe'): 181 | print('RANDOM FOREST Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 182 | elif(tp_randfor=='r2l'): 183 | print('RANDOM FOREST Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 184 | elif(tp_randfor=='u2r'): 185 | print('RANDOM FOREST Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 186 | else: 187 | print('RANDOM FOREST DESCRIPTION : Data is safe') 188 | tp1=l1 189 | scaler = Normalizer().fit(tp1) 190 | tp1 = scaler.transform(tp1) 191 | np.set_printoptions(precision=3) 192 | tp1 = np.reshape(tp1, (tp1.shape[0],1, tp1.shape[1])) 193 | val_cnn=cnn_bin.predict(tp1,verbose=0) 194 | tp=[] 195 | for i in val_cnn: 196 | for j in i: 197 | tp.append(round(j)) 198 | if(tp[0]==1): 199 | print('CNN Algorithm binary class: Attack') 200 | else: 201 | print('CNN Algorithm binary class: Normal') 202 | tp1=l1 203 | scaler = Normalizer().fit(tp1) 204 | tp1 = scaler.transform(tp1) 205 | np.set_printoptions(precision=3) 206 | tp1 = np.reshape(tp1, (tp1.shape[0], tp1.shape[1],1)) 207 | tp_cnn=cnn_multi.predict(tp1,verbose=0) 208 | l=[] 209 | for i in tp_cnn: 210 | for j in i: 211 | l.append(round(j)) 212 | if(l[0]==1): 213 | print('CNN Algorithm Multi class Type:Dos') 214 | print('CNN Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 215 | 216 | elif(l[2]==1): 217 | print('CNN Algorithm Multi class Type:Probe') 218 | print('CNN Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 219 | 220 | elif(l[3]==1): 221 | print('CNN Algorithm Multi class Type:R2L') 222 | print('CNN Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 223 | 224 | elif(l[4]==1): 225 | print('CNN Algorithm Multi class Type:U2R') 226 | print('CNN Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 227 | 228 | elif(l[1]==1): 229 | print('CNN Algorithm Multi class Type:NORMAL') 230 | print('CNN Description : This Is Safe') 231 | 232 | tp1=l1 233 | scaler = Normalizer().fit(tp1) 234 | tp1 = scaler.transform(tp1) 235 | np.set_printoptions(precision=3) 236 | tp1 = np.reshape(tp1, (tp1.shape[0],1, tp1.shape[1])) 237 | val_lstm=lstm_bin.predict(tp1,verbose=0) 238 | tp=[] 239 | for i in val_lstm: 240 | for j in i: 241 | tp.append(round(j)) 242 | if(tp[0]==1): 243 | print('LSTM Algorithm binary class: Attack') 244 | else: 245 | print('LSTM Algorithm binary class: Normal') 246 | tp1=l1 247 | scaler = Normalizer().fit(tp1) 248 | tp1 = scaler.transform(tp1) 249 | np.set_printoptions(precision=3) 250 | tp1 = np.reshape(tp1, (tp1.shape[0],1, tp1.shape[1])) 251 | tp_lstm=lstm_multi.predict(tp1,verbose=0) 252 | l=[] 253 | for i in tp_lstm: 254 | for j in i: 255 | l.append(round(j)) 256 | if(l[0]==1): 257 | print('LSTM Algorithm Multi class Type:Dos') 258 | print('LSTM Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 259 | 260 | elif(l[2]==1): 261 | print('LSTM Algorithm Multi class Type:Probe') 262 | print('LSTM Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 263 | 264 | elif(l[3]==1): 265 | print('LSTM Algorithm Multi class Type:R2L') 266 | print('LSTM Multi Class Type : R2L') 267 | 268 | elif(l[4]==1): 269 | print('LSTM Algorithm Multi class Type:U2R') 270 | print('LSTM Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 271 | 272 | elif(l[1]==1): 273 | print('LSTM Algorithm Multi class Type:NORMAL') 274 | print('LSTM Description : This Is Safe') 275 | 276 | -------------------------------------------------------------------------------- /nids_random_updated.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | from sklearn.metrics import accuracy_score, confusion_matrix 4 | import pandas as pd 5 | from sklearn.preprocessing import LabelEncoder 6 | from sklearn.preprocessing import MinMaxScaler 7 | import sklearn 8 | from sklearn.neighbors import KNeighborsClassifier 9 | import os 10 | from sklearn.preprocessing import LabelEncoder 11 | import tensorflow as tf 12 | from sklearn.preprocessing import Normalizer 13 | import pickle 14 | os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0' 15 | 16 | data_Validate=pd.read_csv('fs_new validation project.csv') 17 | columns = (['protocol_type','service','flag','logged_in','count','srv_serror_rate','srv_rerror_rate','same_srv_rate','diff_srv_rate','dst_host_count','dst_host_srv_count','dst_host_same_srv_rate','dst_host_diff_srv_rate','dst_host_same_src_port_rate','dst_host_serror_rate','dst_host_rerror_rate','attack']) 18 | data_Validate.columns=columns 19 | protocol_type_le = LabelEncoder() 20 | service_le = LabelEncoder() 21 | flag_le = LabelEncoder() 22 | data_Validate['protocol_type'] = protocol_type_le.fit_transform(data_Validate['protocol_type']) 23 | data_Validate['service'] = service_le.fit_transform(data_Validate['service']) 24 | data_Validate['flag'] = flag_le.fit_transform(data_Validate['flag']) 25 | df_validate=data_Validate.copy(deep=True) 26 | x_validate=df_validate.drop(['attack'],axis=1) 27 | y_validate=pd.DataFrame(df_validate['attack']) 28 | label_encoder = LabelEncoder() 29 | scaler=MinMaxScaler() 30 | x1=x_validate.copy(deep=True) 31 | scaler=MinMaxScaler() 32 | scaler.fit(x1) 33 | scaled_data=scaler.transform(x1) 34 | scaled_data=pd.DataFrame(scaled_data) 35 | scaled_data.columns= x1.columns 36 | x_validate=scaled_data 37 | 38 | with open('knn_binary_class.sav', 'rb') as f: 39 | knn_bin = pickle.load(f) 40 | 41 | with open('knn_multi_class.sav', 'rb') as f: 42 | knn_multi = pickle.load(f) 43 | 44 | 45 | with open('random_forest_binary_class.sav', 'rb') as f: 46 | randfor_bin = pickle.load(f) 47 | 48 | 49 | with open('random_forest_multi_class.sav', 'rb') as f: 50 | randfor_multi = pickle.load(f) 51 | 52 | 53 | #knn_bin = pickle.load(open('knn_binary_class.sav', 'rb')) 54 | # knn_multi = pickle.load(open('knn_multi_class.sav', 'rb')) 55 | # randfor_bin = pickle.load(open('random_forest_binary_class.sav', 'rb')) 56 | # randfor_multi = pickle.load(open('random_forest_multi_class.sav', 'rb')) 57 | cnn_bin= tf.keras.models.load_model('latest_cnn_bin.h5') 58 | cnn_multi= tf.keras.models.load_model('latest_cnn_multiclass.h5') 59 | lstm_bin= tf.keras.models.load_model('lstm_latest_bin.h5') 60 | lstm_multi= tf.keras.models.load_model('lstm_latest_multiclass.h5') 61 | def advance(): 62 | #print("KNN ALGORITHM:") 63 | tp=x_validate.sample() 64 | val_knn=knn_bin.predict(tp) 65 | if(val_knn==1): 66 | for i in val_knn: 67 | val_knn=i 68 | print('KNN Binary Class Type : ATTACK') 69 | tp_knn=knn_multi.predict(tp) 70 | print('KNN Multi Class Type : ',tp_knn) 71 | if(tp_knn=='dos'): 72 | print('KNN Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 73 | elif(tp_knn=='probe'): 74 | print('KNN Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 75 | elif(tp_knn=='r2l'): 76 | print('KNN Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 77 | elif(tp_knn=='u2r'): 78 | print('KNN Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 79 | elif(val_knn==0): 80 | print('KNN Binary Class Type : NORMAL') 81 | tp_knn=knn_multi.predict(tp) 82 | print('KNN Multi Class Type : ',tp_knn) 83 | if(tp_knn=='normal'): 84 | print('KNN Description : This Is Safe.') 85 | 86 | #print("RANDOM FOREST ALGORITHM:") 87 | val_randfor=randfor_bin.predict(tp) 88 | if(val_randfor==1): 89 | print('RANDOM FOREST Binary Class Type : ATTACK') 90 | #print('KNN Binary Class Type : ATTACK') 91 | tp_rnd_for=knn_multi.predict(tp) 92 | for i in tp_rnd_for: 93 | tp_rnd_for=i 94 | print('RANDOM FOREST Multi Class Type : ',tp_rnd_for) 95 | if(tp_rnd_for=='dos'): 96 | print('RANDOM FOREST Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 97 | elif(tp_rnd_for=='probe'): 98 | print('RANDOM FOREST Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 99 | elif(tp_rnd_for=='r2l'): 100 | print('RANDOM FOREST Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 101 | elif(tp_rnd_for=='u2r'): 102 | print('RANDOM FOREST Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 103 | 104 | 105 | elif(val_randfor==0): 106 | print('RANDOM FOREST Binary Class Type: NORMAL') 107 | tp_randfor=randfor_multi.predict(tp) 108 | print('RANDOM FOREST Multi Class Type : ',tp_randfor) 109 | if(tp_randfor=='normal'): 110 | print('RANDOM FOREST Description : This Is Safe.') 111 | tp1=tp 112 | scaler = Normalizer().fit(tp1) 113 | tp1 = scaler.transform(tp1) 114 | np.set_printoptions(precision=3) 115 | tp1 = np.reshape(tp1, (tp1.shape[0],1, tp1.shape[1])) 116 | val_cnn=cnn_bin.predict(tp1,verbose=False) 117 | for i in val_cnn: 118 | for j in i: 119 | val_cnn=round(j) 120 | if(val_cnn==1): 121 | print('CNN Binary Class Type: ATTACK') 122 | tp1=tp 123 | scaler = Normalizer().fit(tp1) 124 | tp1 = scaler.transform(tp1) 125 | np.set_printoptions(precision=3) 126 | tp1 = np.reshape(tp1, (tp1.shape[0], tp1.shape[1],1)) 127 | tp_cnn=cnn_multi.predict(tp1,verbose=0) 128 | l=[] 129 | for i in tp_cnn: 130 | for j in i: 131 | l.append(round(j)) 132 | if(l[0]==1): 133 | print('CNN Multi Class Type : DoS') 134 | print('CNN Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 135 | elif(l[2]==1): 136 | print('CNN Multi Class Type : Probe') 137 | print('CNN Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 138 | elif(l[3]==1): 139 | print('CNN Multi Class Type : R2L') 140 | print('CNN Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 141 | elif(l[4]==1): 142 | print('CNN Multi Class Type : U2R') 143 | print('CNN Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 144 | elif(l[1]==1): 145 | print('CNN Multi Class Type : NORMAL') 146 | print('CNN Description : This Is Safe') 147 | elif(val_cnn==0): 148 | print('CNN Binary Class Type : NORMAL') 149 | tp1=tp 150 | scaler = Normalizer().fit(tp1) 151 | tp1 = scaler.transform(tp1) 152 | np.set_printoptions(precision=3) 153 | tp1 = np.reshape(tp1, (tp1.shape[0], tp1.shape[1],1)) 154 | tp_cnn=cnn_multi.predict(tp1,verbose=0) 155 | l=[] 156 | for i in tp_cnn: 157 | for j in i: 158 | l.append(round(j)) 159 | if(l[0]==1): 160 | print('CNN Multi Class Type : DoS') 161 | print('CNN Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 162 | elif(l[2]==1): 163 | print('CNN Multi Class Type : Probe') 164 | print('CNN Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 165 | elif(l[3]==1): 166 | print('CNN Multi Class Type : R2L') 167 | print('CNN Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 168 | elif(l[4]==1): 169 | print('CNN Multi Class Type : U2R') 170 | print('CNN Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 171 | elif(l[1]==1): 172 | print('CNN Multi Class Type : Normal') 173 | print('CNN Description : This Is Safe') 174 | 175 | #print("LSTM ALGORITHM:") 176 | tp1=tp 177 | scaler = Normalizer().fit(tp1) 178 | tp1 = scaler.transform(tp1) 179 | np.set_printoptions(precision=3) 180 | tp1 = np.reshape(tp1, (tp1.shape[0],1, tp1.shape[1])) 181 | val_lstm=lstm_bin.predict(tp1,verbose=False) 182 | for i in val_lstm: 183 | for j in i: 184 | val_lstm=round(j) 185 | if(val_lstm==1): 186 | print('LSTM Binary Class Type : ATTACK') 187 | tp1=tp 188 | scaler = Normalizer().fit(tp1) 189 | tp1 = scaler.transform(tp1) 190 | np.set_printoptions(precision=3) 191 | tp1 = np.reshape(tp1, (tp1.shape[0], 1,tp1.shape[1])) 192 | tp_lstm=lstm_multi.predict(tp1,verbose=0) 193 | #tp_lstm=lstm_multi.predict(tp,verbose=0) 194 | l=[] 195 | for i in tp_lstm: 196 | for j in i: 197 | l.append(round(j)) 198 | if(l[0]==1): 199 | print('LSTM Multi Class Type : DoS') 200 | print('LSTM Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 201 | elif(l[2]==1): 202 | print('LSTM Multi Class Type : Probe') 203 | print('LSTM Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 204 | elif(l[3]==1): 205 | print('LSTM Multi Class Type : R2L') 206 | print('LSTM Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 207 | elif(l[4]==1): 208 | print('LSTM Multi Class Type:U2R') 209 | print('LSTM Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 210 | elif(l[1]==1): 211 | print('LSTM Multi class Type : Normal') 212 | print('LSTM Description : This Is Safe') 213 | elif(round(val_lstm)==0): 214 | print('LSTM-Binary Class Type : NORMAL') 215 | tp1=tp 216 | scaler = Normalizer().fit(tp1) 217 | tp1 = scaler.transform(tp1) 218 | np.set_printoptions(precision=3) 219 | tp1 = np.reshape(tp1, (tp1.shape[0], 1,tp1.shape[1])) 220 | tp_lstm=lstm_multi.predict(tp1,verbose=0) 221 | #tp_lstm=lstm_multi.predict(tp,verbose=0) 222 | l=[] 223 | for i in tp_lstm: 224 | for j in i: 225 | l.append(round(j)) 226 | if(l[0]==1): 227 | print('LSTM Multi Class Type : DoS') 228 | print('LSTM Description : A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 229 | elif(l[2]==1): 230 | print('LSTM Multi Class Type : Probe') 231 | print('LSTM Description : Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 232 | elif(l[3]==1): 233 | print('LSTM Multi Class Type : R2L') 234 | print('LSTM Description : Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 235 | elif(l[4]==1): 236 | print('LSTM Multi Class Type : U2R') 237 | print('LSTM Description : User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 238 | elif(l[1]==1): 239 | print('LSTM Multi Class Type : Normal') 240 | print('LSTM Description : This Is Safe') 241 | advance() 242 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "secrets", 3 | "version": "1.0.0", 4 | "description": "Cyber Security: Development of Network Intrusion Detection System (NIDS), with Machine Learning and Deep Learning, Recurrent Neural Network models, MERN web I/O System.\r ## How to start: \r Step-1 : Fork or Clone the project using command [git clone \"https://github.com/Shaik-Sohail-72/Network-Intrusion-Detection-Using-Deep-Learning.git\"] \r Step-2 : Create a .env file and set up the dovenv variable which is used in app.js (or) remove dotenv variables from app.js and set the links like mongoDB link etc. \r Step-3 : Use command [npm install] to install all the packages. \r Step-4 : Use command [node app.js] to run it locally.\r ## Description : \r Large numbers of businesses were affected by data infringes and Cyber -attacks due to dependency on internet. To prevent such malicious activity, the network requires a system that detects anomaly and inform the user and alerts the user.", 5 | "main": "app.js", 6 | "dependencies": { 7 | "body-parser": "^1.18.3", 8 | "cookie-parser": "^1.4.6", 9 | "dotenv": "^6.2.0", 10 | "download": "^8.0.0", 11 | "ejs": "^2.6.1", 12 | "express": "4.13.3", 13 | "express-session": "^1.15.6", 14 | "flatted": "^3.2.7", 15 | "mongoose": "^8.2.2", 16 | "mongoose-findorcreate": "^3.0.0", 17 | "multer": "^1.4.4", 18 | "nodemon": "^2.0.22", 19 | "passport": "^0.7.0", 20 | "passport-google-oauth2": "^0.2.0", 21 | "passport-google-oauth20": "^2.0.0", 22 | "passport-local": "^1.0.0", 23 | "passport-local-mongoose": "^5.0.1", 24 | "python-shell": "^3.0.1" 25 | }, 26 | "scripts": { 27 | "start": "nodemon app.js", 28 | "test": "echo \"Error: no test specified\" && exit 1" 29 | }, 30 | "keywords": [], 31 | "author": "", 32 | "license": "ISC", 33 | "engines": { 34 | "node": "18.x", 35 | "npm": "x.7" 36 | }, 37 | "devDependencies": { 38 | "mocha": "~2.3.3", 39 | "should": "~7.1.0", 40 | "supertest": "~1.1.0" 41 | }, 42 | "repository": { 43 | "type": "git", 44 | "url": "git+https://github.com/MohdSaif-1807/Network-Intrusion-Detection-Using-Deep-Learning.git" 45 | }, 46 | "bugs": { 47 | "url": "https://github.com/MohdSaif-1807/Network-Intrusion-Detection-Using-Deep-Learning/issues" 48 | }, 49 | "homepage": "https://github.com/MohdSaif-1807/Network-Intrusion-Detection-Using-Deep-Learning#readme" 50 | } 51 | -------------------------------------------------------------------------------- /public/css/boostrap-social.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Social Buttons for Bootstrap 3 | * 4 | * Copyright 2013-2016 Panayiotis Lipiridis 5 | * Licensed under the MIT License 6 | * 7 | * https://github.com/lipis/bootstrap-social 8 | */ 9 | 10 | .btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)} 11 | .btn-social.btn-lg{padding-left:61px}.btn-social.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em} 12 | .btn-social.btn-sm{padding-left:38px}.btn-social.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em} 13 | .btn-social.btn-xs{padding-left:30px}.btn-social.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em} 14 | .btn-social-icon{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:34px;width:34px;padding:0}.btn-social-icon>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)} 15 | .btn-social-icon.btn-lg{padding-left:61px}.btn-social-icon.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em} 16 | .btn-social-icon.btn-sm{padding-left:38px}.btn-social-icon.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em} 17 | .btn-social-icon.btn-xs{padding-left:30px}.btn-social-icon.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em} 18 | .btn-social-icon>:first-child{border:none;text-align:center;width:100% !important} 19 | .btn-social-icon.btn-lg{height:45px;width:45px;padding-left:0;padding-right:0} 20 | .btn-social-icon.btn-sm{height:30px;width:30px;padding-left:0;padding-right:0} 21 | .btn-social-icon.btn-xs{height:22px;width:22px;padding-left:0;padding-right:0} 22 | .btn-adn{color:#fff;background-color:#d87a68;border-color:rgba(0,0,0,0.2)}.btn-adn:focus,.btn-adn.focus{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,0.2)} 23 | .btn-adn:hover{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,0.2)} 24 | .btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,0.2)}.btn-adn:active:hover,.btn-adn.active:hover,.open>.dropdown-toggle.btn-adn:hover,.btn-adn:active:focus,.btn-adn.active:focus,.open>.dropdown-toggle.btn-adn:focus,.btn-adn:active.focus,.btn-adn.active.focus,.open>.dropdown-toggle.btn-adn.focus{color:#fff;background-color:#b94630;border-color:rgba(0,0,0,0.2)} 25 | .btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{background-image:none} 26 | .btn-adn.disabled:hover,.btn-adn[disabled]:hover,fieldset[disabled] .btn-adn:hover,.btn-adn.disabled:focus,.btn-adn[disabled]:focus,fieldset[disabled] .btn-adn:focus,.btn-adn.disabled.focus,.btn-adn[disabled].focus,fieldset[disabled] .btn-adn.focus{background-color:#d87a68;border-color:rgba(0,0,0,0.2)} 27 | .btn-adn .badge{color:#d87a68;background-color:#fff} 28 | .btn-bitbucket{color:#fff;background-color:#205081;border-color:rgba(0,0,0,0.2)}.btn-bitbucket:focus,.btn-bitbucket.focus{color:#fff;background-color:#163758;border-color:rgba(0,0,0,0.2)} 29 | .btn-bitbucket:hover{color:#fff;background-color:#163758;border-color:rgba(0,0,0,0.2)} 30 | .btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{color:#fff;background-color:#163758;border-color:rgba(0,0,0,0.2)}.btn-bitbucket:active:hover,.btn-bitbucket.active:hover,.open>.dropdown-toggle.btn-bitbucket:hover,.btn-bitbucket:active:focus,.btn-bitbucket.active:focus,.open>.dropdown-toggle.btn-bitbucket:focus,.btn-bitbucket:active.focus,.btn-bitbucket.active.focus,.open>.dropdown-toggle.btn-bitbucket.focus{color:#fff;background-color:#0f253c;border-color:rgba(0,0,0,0.2)} 31 | .btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{background-image:none} 32 | .btn-bitbucket.disabled:hover,.btn-bitbucket[disabled]:hover,fieldset[disabled] .btn-bitbucket:hover,.btn-bitbucket.disabled:focus,.btn-bitbucket[disabled]:focus,fieldset[disabled] .btn-bitbucket:focus,.btn-bitbucket.disabled.focus,.btn-bitbucket[disabled].focus,fieldset[disabled] .btn-bitbucket.focus{background-color:#205081;border-color:rgba(0,0,0,0.2)} 33 | .btn-bitbucket .badge{color:#205081;background-color:#fff} 34 | .btn-dropbox{color:#fff;background-color:#1087dd;border-color:rgba(0,0,0,0.2)}.btn-dropbox:focus,.btn-dropbox.focus{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,0.2)} 35 | .btn-dropbox:hover{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,0.2)} 36 | .btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,0.2)}.btn-dropbox:active:hover,.btn-dropbox.active:hover,.open>.dropdown-toggle.btn-dropbox:hover,.btn-dropbox:active:focus,.btn-dropbox.active:focus,.open>.dropdown-toggle.btn-dropbox:focus,.btn-dropbox:active.focus,.btn-dropbox.active.focus,.open>.dropdown-toggle.btn-dropbox.focus{color:#fff;background-color:#0a568c;border-color:rgba(0,0,0,0.2)} 37 | .btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{background-image:none} 38 | .btn-dropbox.disabled:hover,.btn-dropbox[disabled]:hover,fieldset[disabled] .btn-dropbox:hover,.btn-dropbox.disabled:focus,.btn-dropbox[disabled]:focus,fieldset[disabled] .btn-dropbox:focus,.btn-dropbox.disabled.focus,.btn-dropbox[disabled].focus,fieldset[disabled] .btn-dropbox.focus{background-color:#1087dd;border-color:rgba(0,0,0,0.2)} 39 | .btn-dropbox .badge{color:#1087dd;background-color:#fff} 40 | .btn-facebook{color:#fff;background-color:#3b5998;border-color:rgba(0,0,0,0.2)}.btn-facebook:focus,.btn-facebook.focus{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,0.2)} 41 | .btn-facebook:hover{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,0.2)} 42 | .btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,0.2)}.btn-facebook:active:hover,.btn-facebook.active:hover,.open>.dropdown-toggle.btn-facebook:hover,.btn-facebook:active:focus,.btn-facebook.active:focus,.open>.dropdown-toggle.btn-facebook:focus,.btn-facebook:active.focus,.btn-facebook.active.focus,.open>.dropdown-toggle.btn-facebook.focus{color:#fff;background-color:#23345a;border-color:rgba(0,0,0,0.2)} 43 | .btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{background-image:none} 44 | .btn-facebook.disabled:hover,.btn-facebook[disabled]:hover,fieldset[disabled] .btn-facebook:hover,.btn-facebook.disabled:focus,.btn-facebook[disabled]:focus,fieldset[disabled] .btn-facebook:focus,.btn-facebook.disabled.focus,.btn-facebook[disabled].focus,fieldset[disabled] .btn-facebook.focus{background-color:#3b5998;border-color:rgba(0,0,0,0.2)} 45 | .btn-facebook .badge{color:#3b5998;background-color:#fff} 46 | .btn-flickr{color:#fff;background-color:#ff0084;border-color:rgba(0,0,0,0.2)}.btn-flickr:focus,.btn-flickr.focus{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,0.2)} 47 | .btn-flickr:hover{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,0.2)} 48 | .btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,0.2)}.btn-flickr:active:hover,.btn-flickr.active:hover,.open>.dropdown-toggle.btn-flickr:hover,.btn-flickr:active:focus,.btn-flickr.active:focus,.open>.dropdown-toggle.btn-flickr:focus,.btn-flickr:active.focus,.btn-flickr.active.focus,.open>.dropdown-toggle.btn-flickr.focus{color:#fff;background-color:#a80057;border-color:rgba(0,0,0,0.2)} 49 | .btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{background-image:none} 50 | .btn-flickr.disabled:hover,.btn-flickr[disabled]:hover,fieldset[disabled] .btn-flickr:hover,.btn-flickr.disabled:focus,.btn-flickr[disabled]:focus,fieldset[disabled] .btn-flickr:focus,.btn-flickr.disabled.focus,.btn-flickr[disabled].focus,fieldset[disabled] .btn-flickr.focus{background-color:#ff0084;border-color:rgba(0,0,0,0.2)} 51 | .btn-flickr .badge{color:#ff0084;background-color:#fff} 52 | .btn-foursquare{color:#fff;background-color:#f94877;border-color:rgba(0,0,0,0.2)}.btn-foursquare:focus,.btn-foursquare.focus{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,0.2)} 53 | .btn-foursquare:hover{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,0.2)} 54 | .btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,0.2)}.btn-foursquare:active:hover,.btn-foursquare.active:hover,.open>.dropdown-toggle.btn-foursquare:hover,.btn-foursquare:active:focus,.btn-foursquare.active:focus,.open>.dropdown-toggle.btn-foursquare:focus,.btn-foursquare:active.focus,.btn-foursquare.active.focus,.open>.dropdown-toggle.btn-foursquare.focus{color:#fff;background-color:#e30742;border-color:rgba(0,0,0,0.2)} 55 | .btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{background-image:none} 56 | .btn-foursquare.disabled:hover,.btn-foursquare[disabled]:hover,fieldset[disabled] .btn-foursquare:hover,.btn-foursquare.disabled:focus,.btn-foursquare[disabled]:focus,fieldset[disabled] .btn-foursquare:focus,.btn-foursquare.disabled.focus,.btn-foursquare[disabled].focus,fieldset[disabled] .btn-foursquare.focus{background-color:#f94877;border-color:rgba(0,0,0,0.2)} 57 | .btn-foursquare .badge{color:#f94877;background-color:#fff} 58 | .btn-github{color:#fff;background-color:#444;border-color:rgba(0,0,0,0.2)}.btn-github:focus,.btn-github.focus{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,0.2)} 59 | .btn-github:hover{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,0.2)} 60 | .btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,0.2)}.btn-github:active:hover,.btn-github.active:hover,.open>.dropdown-toggle.btn-github:hover,.btn-github:active:focus,.btn-github.active:focus,.open>.dropdown-toggle.btn-github:focus,.btn-github:active.focus,.btn-github.active.focus,.open>.dropdown-toggle.btn-github.focus{color:#fff;background-color:#191919;border-color:rgba(0,0,0,0.2)} 61 | .btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{background-image:none} 62 | .btn-github.disabled:hover,.btn-github[disabled]:hover,fieldset[disabled] .btn-github:hover,.btn-github.disabled:focus,.btn-github[disabled]:focus,fieldset[disabled] .btn-github:focus,.btn-github.disabled.focus,.btn-github[disabled].focus,fieldset[disabled] .btn-github.focus{background-color:#444;border-color:rgba(0,0,0,0.2)} 63 | .btn-github .badge{color:#444;background-color:#fff} 64 | 65 | .btn-google{color:#fff;background-color:#dd4b39;border-color:rgba(0,0,0,0.2)}.btn-google:focus,.btn-google.focus{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,0.2)} 66 | .btn-google:hover{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,0.2)} 67 | .btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,0.2)}.btn-google:active:hover,.btn-google.active:hover,.open>.dropdown-toggle.btn-google:hover,.btn-google:active:focus,.btn-google.active:focus,.open>.dropdown-toggle.btn-google:focus,.btn-google:active.focus,.btn-google.active.focus,.open>.dropdown-toggle.btn-google.focus{color:#fff;background-color:#a32b1c;border-color:rgba(0,0,0,0.2)} 68 | .btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{background-image:none} 69 | .btn-google.disabled:hover,.btn-google[disabled]:hover,fieldset[disabled] .btn-google:hover,.btn-google.disabled:focus,.btn-google[disabled]:focus,fieldset[disabled] .btn-google:focus,.btn-google.disabled.focus,.btn-google[disabled].focus,fieldset[disabled] .btn-google.focus{background-color:#dd4b39;border-color:rgba(0,0,0,0.2)} 70 | .btn-google .badge{color:#dd4b39;background-color:#fff} 71 | .btn-instagram{color:#fff;background-color:#3f729b;border-color:rgba(0,0,0,0.2)}.btn-instagram:focus,.btn-instagram.focus{color:#fff;background-color:#305777;border-color:rgba(0,0,0,0.2)} 72 | .btn-instagram:hover{color:#fff;background-color:#305777;border-color:rgba(0,0,0,0.2)} 73 | .btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{color:#fff;background-color:#305777;border-color:rgba(0,0,0,0.2)}.btn-instagram:active:hover,.btn-instagram.active:hover,.open>.dropdown-toggle.btn-instagram:hover,.btn-instagram:active:focus,.btn-instagram.active:focus,.open>.dropdown-toggle.btn-instagram:focus,.btn-instagram:active.focus,.btn-instagram.active.focus,.open>.dropdown-toggle.btn-instagram.focus{color:#fff;background-color:#26455d;border-color:rgba(0,0,0,0.2)} 74 | .btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{background-image:none} 75 | .btn-instagram.disabled:hover,.btn-instagram[disabled]:hover,fieldset[disabled] .btn-instagram:hover,.btn-instagram.disabled:focus,.btn-instagram[disabled]:focus,fieldset[disabled] .btn-instagram:focus,.btn-instagram.disabled.focus,.btn-instagram[disabled].focus,fieldset[disabled] .btn-instagram.focus{background-color:#3f729b;border-color:rgba(0,0,0,0.2)} 76 | .btn-instagram .badge{color:#3f729b;background-color:#fff} 77 | .btn-linkedin{color:#fff;background-color:#007bb6;border-color:rgba(0,0,0,0.2)}.btn-linkedin:focus,.btn-linkedin.focus{color:#fff;background-color:#005983;border-color:rgba(0,0,0,0.2)} 78 | .btn-linkedin:hover{color:#fff;background-color:#005983;border-color:rgba(0,0,0,0.2)} 79 | .btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{color:#fff;background-color:#005983;border-color:rgba(0,0,0,0.2)}.btn-linkedin:active:hover,.btn-linkedin.active:hover,.open>.dropdown-toggle.btn-linkedin:hover,.btn-linkedin:active:focus,.btn-linkedin.active:focus,.open>.dropdown-toggle.btn-linkedin:focus,.btn-linkedin:active.focus,.btn-linkedin.active.focus,.open>.dropdown-toggle.btn-linkedin.focus{color:#fff;background-color:#00405f;border-color:rgba(0,0,0,0.2)} 80 | .btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{background-image:none} 81 | .btn-linkedin.disabled:hover,.btn-linkedin[disabled]:hover,fieldset[disabled] .btn-linkedin:hover,.btn-linkedin.disabled:focus,.btn-linkedin[disabled]:focus,fieldset[disabled] .btn-linkedin:focus,.btn-linkedin.disabled.focus,.btn-linkedin[disabled].focus,fieldset[disabled] .btn-linkedin.focus{background-color:#007bb6;border-color:rgba(0,0,0,0.2)} 82 | .btn-linkedin .badge{color:#007bb6;background-color:#fff} 83 | .btn-microsoft{color:#fff;background-color:#2672ec;border-color:rgba(0,0,0,0.2)}.btn-microsoft:focus,.btn-microsoft.focus{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,0.2)} 84 | .btn-microsoft:hover{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,0.2)} 85 | .btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,0.2)}.btn-microsoft:active:hover,.btn-microsoft.active:hover,.open>.dropdown-toggle.btn-microsoft:hover,.btn-microsoft:active:focus,.btn-microsoft.active:focus,.open>.dropdown-toggle.btn-microsoft:focus,.btn-microsoft:active.focus,.btn-microsoft.active.focus,.open>.dropdown-toggle.btn-microsoft.focus{color:#fff;background-color:#0f4bac;border-color:rgba(0,0,0,0.2)} 86 | .btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{background-image:none} 87 | .btn-microsoft.disabled:hover,.btn-microsoft[disabled]:hover,fieldset[disabled] .btn-microsoft:hover,.btn-microsoft.disabled:focus,.btn-microsoft[disabled]:focus,fieldset[disabled] .btn-microsoft:focus,.btn-microsoft.disabled.focus,.btn-microsoft[disabled].focus,fieldset[disabled] .btn-microsoft.focus{background-color:#2672ec;border-color:rgba(0,0,0,0.2)} 88 | .btn-microsoft .badge{color:#2672ec;background-color:#fff} 89 | .btn-odnoklassniki{color:#fff;background-color:#f4731c;border-color:rgba(0,0,0,0.2)}.btn-odnoklassniki:focus,.btn-odnoklassniki.focus{color:#fff;background-color:#d35b0a;border-color:rgba(0,0,0,0.2)} 90 | .btn-odnoklassniki:hover{color:#fff;background-color:#d35b0a;border-color:rgba(0,0,0,0.2)} 91 | .btn-odnoklassniki:active,.btn-odnoklassniki.active,.open>.dropdown-toggle.btn-odnoklassniki{color:#fff;background-color:#d35b0a;border-color:rgba(0,0,0,0.2)}.btn-odnoklassniki:active:hover,.btn-odnoklassniki.active:hover,.open>.dropdown-toggle.btn-odnoklassniki:hover,.btn-odnoklassniki:active:focus,.btn-odnoklassniki.active:focus,.open>.dropdown-toggle.btn-odnoklassniki:focus,.btn-odnoklassniki:active.focus,.btn-odnoklassniki.active.focus,.open>.dropdown-toggle.btn-odnoklassniki.focus{color:#fff;background-color:#b14c09;border-color:rgba(0,0,0,0.2)} 92 | .btn-odnoklassniki:active,.btn-odnoklassniki.active,.open>.dropdown-toggle.btn-odnoklassniki{background-image:none} 93 | .btn-odnoklassniki.disabled:hover,.btn-odnoklassniki[disabled]:hover,fieldset[disabled] .btn-odnoklassniki:hover,.btn-odnoklassniki.disabled:focus,.btn-odnoklassniki[disabled]:focus,fieldset[disabled] .btn-odnoklassniki:focus,.btn-odnoklassniki.disabled.focus,.btn-odnoklassniki[disabled].focus,fieldset[disabled] .btn-odnoklassniki.focus{background-color:#f4731c;border-color:rgba(0,0,0,0.2)} 94 | .btn-odnoklassniki .badge{color:#f4731c;background-color:#fff} 95 | .btn-openid{color:#fff;background-color:#f7931e;border-color:rgba(0,0,0,0.2)}.btn-openid:focus,.btn-openid.focus{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,0.2)} 96 | .btn-openid:hover{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,0.2)} 97 | .btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,0.2)}.btn-openid:active:hover,.btn-openid.active:hover,.open>.dropdown-toggle.btn-openid:hover,.btn-openid:active:focus,.btn-openid.active:focus,.open>.dropdown-toggle.btn-openid:focus,.btn-openid:active.focus,.btn-openid.active.focus,.open>.dropdown-toggle.btn-openid.focus{color:#fff;background-color:#b86607;border-color:rgba(0,0,0,0.2)} 98 | .btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{background-image:none} 99 | .btn-openid.disabled:hover,.btn-openid[disabled]:hover,fieldset[disabled] .btn-openid:hover,.btn-openid.disabled:focus,.btn-openid[disabled]:focus,fieldset[disabled] .btn-openid:focus,.btn-openid.disabled.focus,.btn-openid[disabled].focus,fieldset[disabled] .btn-openid.focus{background-color:#f7931e;border-color:rgba(0,0,0,0.2)} 100 | .btn-openid .badge{color:#f7931e;background-color:#fff} 101 | .btn-pinterest{color:#fff;background-color:#cb2027;border-color:rgba(0,0,0,0.2)}.btn-pinterest:focus,.btn-pinterest.focus{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,0.2)} 102 | .btn-pinterest:hover{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,0.2)} 103 | .btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,0.2)}.btn-pinterest:active:hover,.btn-pinterest.active:hover,.open>.dropdown-toggle.btn-pinterest:hover,.btn-pinterest:active:focus,.btn-pinterest.active:focus,.open>.dropdown-toggle.btn-pinterest:focus,.btn-pinterest:active.focus,.btn-pinterest.active.focus,.open>.dropdown-toggle.btn-pinterest.focus{color:#fff;background-color:#801419;border-color:rgba(0,0,0,0.2)} 104 | .btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{background-image:none} 105 | .btn-pinterest.disabled:hover,.btn-pinterest[disabled]:hover,fieldset[disabled] .btn-pinterest:hover,.btn-pinterest.disabled:focus,.btn-pinterest[disabled]:focus,fieldset[disabled] .btn-pinterest:focus,.btn-pinterest.disabled.focus,.btn-pinterest[disabled].focus,fieldset[disabled] .btn-pinterest.focus{background-color:#cb2027;border-color:rgba(0,0,0,0.2)} 106 | .btn-pinterest .badge{color:#cb2027;background-color:#fff} 107 | .btn-reddit{color:#000;background-color:#eff7ff;border-color:rgba(0,0,0,0.2)}.btn-reddit:focus,.btn-reddit.focus{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,0.2)} 108 | .btn-reddit:hover{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,0.2)} 109 | .btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,0.2)}.btn-reddit:active:hover,.btn-reddit.active:hover,.open>.dropdown-toggle.btn-reddit:hover,.btn-reddit:active:focus,.btn-reddit.active:focus,.open>.dropdown-toggle.btn-reddit:focus,.btn-reddit:active.focus,.btn-reddit.active.focus,.open>.dropdown-toggle.btn-reddit.focus{color:#000;background-color:#98ccff;border-color:rgba(0,0,0,0.2)} 110 | .btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{background-image:none} 111 | .btn-reddit.disabled:hover,.btn-reddit[disabled]:hover,fieldset[disabled] .btn-reddit:hover,.btn-reddit.disabled:focus,.btn-reddit[disabled]:focus,fieldset[disabled] .btn-reddit:focus,.btn-reddit.disabled.focus,.btn-reddit[disabled].focus,fieldset[disabled] .btn-reddit.focus{background-color:#eff7ff;border-color:rgba(0,0,0,0.2)} 112 | .btn-reddit .badge{color:#eff7ff;background-color:#000} 113 | .btn-soundcloud{color:#fff;background-color:#f50;border-color:rgba(0,0,0,0.2)}.btn-soundcloud:focus,.btn-soundcloud.focus{color:#fff;background-color:#c40;border-color:rgba(0,0,0,0.2)} 114 | .btn-soundcloud:hover{color:#fff;background-color:#c40;border-color:rgba(0,0,0,0.2)} 115 | .btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{color:#fff;background-color:#c40;border-color:rgba(0,0,0,0.2)}.btn-soundcloud:active:hover,.btn-soundcloud.active:hover,.open>.dropdown-toggle.btn-soundcloud:hover,.btn-soundcloud:active:focus,.btn-soundcloud.active:focus,.open>.dropdown-toggle.btn-soundcloud:focus,.btn-soundcloud:active.focus,.btn-soundcloud.active.focus,.open>.dropdown-toggle.btn-soundcloud.focus{color:#fff;background-color:#a83800;border-color:rgba(0,0,0,0.2)} 116 | .btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{background-image:none} 117 | .btn-soundcloud.disabled:hover,.btn-soundcloud[disabled]:hover,fieldset[disabled] .btn-soundcloud:hover,.btn-soundcloud.disabled:focus,.btn-soundcloud[disabled]:focus,fieldset[disabled] .btn-soundcloud:focus,.btn-soundcloud.disabled.focus,.btn-soundcloud[disabled].focus,fieldset[disabled] .btn-soundcloud.focus{background-color:#f50;border-color:rgba(0,0,0,0.2)} 118 | .btn-soundcloud .badge{color:#f50;background-color:#fff} 119 | .btn-tumblr{color:#fff;background-color:#2c4762;border-color:rgba(0,0,0,0.2)}.btn-tumblr:focus,.btn-tumblr.focus{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,0.2)} 120 | .btn-tumblr:hover{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,0.2)} 121 | .btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,0.2)}.btn-tumblr:active:hover,.btn-tumblr.active:hover,.open>.dropdown-toggle.btn-tumblr:hover,.btn-tumblr:active:focus,.btn-tumblr.active:focus,.open>.dropdown-toggle.btn-tumblr:focus,.btn-tumblr:active.focus,.btn-tumblr.active.focus,.open>.dropdown-toggle.btn-tumblr.focus{color:#fff;background-color:#111c26;border-color:rgba(0,0,0,0.2)} 122 | .btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{background-image:none} 123 | .btn-tumblr.disabled:hover,.btn-tumblr[disabled]:hover,fieldset[disabled] .btn-tumblr:hover,.btn-tumblr.disabled:focus,.btn-tumblr[disabled]:focus,fieldset[disabled] .btn-tumblr:focus,.btn-tumblr.disabled.focus,.btn-tumblr[disabled].focus,fieldset[disabled] .btn-tumblr.focus{background-color:#2c4762;border-color:rgba(0,0,0,0.2)} 124 | .btn-tumblr .badge{color:#2c4762;background-color:#fff} 125 | .btn-twitter{color:#fff;background-color:#55acee;border-color:rgba(0,0,0,0.2)}.btn-twitter:focus,.btn-twitter.focus{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,0.2)} 126 | .btn-twitter:hover{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,0.2)} 127 | .btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,0.2)}.btn-twitter:active:hover,.btn-twitter.active:hover,.open>.dropdown-toggle.btn-twitter:hover,.btn-twitter:active:focus,.btn-twitter.active:focus,.open>.dropdown-toggle.btn-twitter:focus,.btn-twitter:active.focus,.btn-twitter.active.focus,.open>.dropdown-toggle.btn-twitter.focus{color:#fff;background-color:#1583d7;border-color:rgba(0,0,0,0.2)} 128 | .btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{background-image:none} 129 | .btn-twitter.disabled:hover,.btn-twitter[disabled]:hover,fieldset[disabled] .btn-twitter:hover,.btn-twitter.disabled:focus,.btn-twitter[disabled]:focus,fieldset[disabled] .btn-twitter:focus,.btn-twitter.disabled.focus,.btn-twitter[disabled].focus,fieldset[disabled] .btn-twitter.focus{background-color:#55acee;border-color:rgba(0,0,0,0.2)} 130 | .btn-twitter .badge{color:#55acee;background-color:#fff} 131 | .btn-vimeo{color:#fff;background-color:#1ab7ea;border-color:rgba(0,0,0,0.2)}.btn-vimeo:focus,.btn-vimeo.focus{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,0.2)} 132 | .btn-vimeo:hover{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,0.2)} 133 | .btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,0.2)}.btn-vimeo:active:hover,.btn-vimeo.active:hover,.open>.dropdown-toggle.btn-vimeo:hover,.btn-vimeo:active:focus,.btn-vimeo.active:focus,.open>.dropdown-toggle.btn-vimeo:focus,.btn-vimeo:active.focus,.btn-vimeo.active.focus,.open>.dropdown-toggle.btn-vimeo.focus{color:#fff;background-color:#0f7b9f;border-color:rgba(0,0,0,0.2)} 134 | .btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{background-image:none} 135 | .btn-vimeo.disabled:hover,.btn-vimeo[disabled]:hover,fieldset[disabled] .btn-vimeo:hover,.btn-vimeo.disabled:focus,.btn-vimeo[disabled]:focus,fieldset[disabled] .btn-vimeo:focus,.btn-vimeo.disabled.focus,.btn-vimeo[disabled].focus,fieldset[disabled] .btn-vimeo.focus{background-color:#1ab7ea;border-color:rgba(0,0,0,0.2)} 136 | .btn-vimeo .badge{color:#1ab7ea;background-color:#fff} 137 | .btn-vk{color:#fff;background-color:#587ea3;border-color:rgba(0,0,0,0.2)}.btn-vk:focus,.btn-vk.focus{color:#fff;background-color:#466482;border-color:rgba(0,0,0,0.2)} 138 | .btn-vk:hover{color:#fff;background-color:#466482;border-color:rgba(0,0,0,0.2)} 139 | .btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{color:#fff;background-color:#466482;border-color:rgba(0,0,0,0.2)}.btn-vk:active:hover,.btn-vk.active:hover,.open>.dropdown-toggle.btn-vk:hover,.btn-vk:active:focus,.btn-vk.active:focus,.open>.dropdown-toggle.btn-vk:focus,.btn-vk:active.focus,.btn-vk.active.focus,.open>.dropdown-toggle.btn-vk.focus{color:#fff;background-color:#3a526b;border-color:rgba(0,0,0,0.2)} 140 | .btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{background-image:none} 141 | .btn-vk.disabled:hover,.btn-vk[disabled]:hover,fieldset[disabled] .btn-vk:hover,.btn-vk.disabled:focus,.btn-vk[disabled]:focus,fieldset[disabled] .btn-vk:focus,.btn-vk.disabled.focus,.btn-vk[disabled].focus,fieldset[disabled] .btn-vk.focus{background-color:#587ea3;border-color:rgba(0,0,0,0.2)} 142 | .btn-vk .badge{color:#587ea3;background-color:#fff} 143 | .btn-yahoo{color:#fff;background-color:#720e9e;border-color:rgba(0,0,0,0.2)}.btn-yahoo:focus,.btn-yahoo.focus{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,0.2)} 144 | .btn-yahoo:hover{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,0.2)} 145 | .btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,0.2)}.btn-yahoo:active:hover,.btn-yahoo.active:hover,.open>.dropdown-toggle.btn-yahoo:hover,.btn-yahoo:active:focus,.btn-yahoo.active:focus,.open>.dropdown-toggle.btn-yahoo:focus,.btn-yahoo:active.focus,.btn-yahoo.active.focus,.open>.dropdown-toggle.btn-yahoo.focus{color:#fff;background-color:#39074e;border-color:rgba(0,0,0,0.2)} 146 | .btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{background-image:none} 147 | .btn-yahoo.disabled:hover,.btn-yahoo[disabled]:hover,fieldset[disabled] .btn-yahoo:hover,.btn-yahoo.disabled:focus,.btn-yahoo[disabled]:focus,fieldset[disabled] .btn-yahoo:focus,.btn-yahoo.disabled.focus,.btn-yahoo[disabled].focus,fieldset[disabled] .btn-yahoo.focus{background-color:#720e9e;border-color:rgba(0,0,0,0.2)} 148 | .btn-yahoo .badge{color:#720e9e;background-color:#fff} 149 | -------------------------------------------------------------------------------- /public/css/homeStyles.css: -------------------------------------------------------------------------------- 1 | 2 | body { 3 | font-family: "Montserrat"; 4 | text-align: center; 5 | } 6 | 7 | h1, h2, h3, h4, h5, h6 { 8 | font-family: "Montserrat-Bold"; 9 | color: #FFFFFF; 10 | } 11 | 12 | p { 13 | color: #DEF5E5; 14 | } 15 | 16 | /* Headings */ 17 | 18 | .big-heading { 19 | font-family: "Montserrat-Black"; 20 | font-size: 3.5rem; 21 | line-height: 1.5; 22 | } 23 | 24 | .section-heading { 25 | font-size: 3rem; 26 | line-height: 1.5; 27 | } 28 | 29 | /* Containers */ 30 | 31 | .container-fluid{ 32 | padding: 7% 7%; 33 | } 34 | #title .container-fluid { 35 | padding: 3% 7% 7%; 36 | } 37 | 38 | /* Sections */ 39 | 40 | .colored-section { 41 | background-color: #00ADB5; 42 | color: #fff; 43 | } 44 | 45 | .white-section { 46 | background-color: #E3FDFD; 47 | } 48 | 49 | /* Navigation Bar */ 50 | 51 | .navbar { 52 | padding: 0 0 4.5rem; 53 | } 54 | 55 | .navbar-brand { 56 | font-family: "Ubuntu"; 57 | font-size: 2.5rem; 58 | font-weight: bold; 59 | 60 | 61 | } 62 | 63 | .nav-item { 64 | padding: 0 18px; 65 | } 66 | 67 | .nav-link { 68 | font-size: 1.2rem; 69 | color: #000; 70 | font-family: "Montserrat-Light"; 71 | } 72 | 73 | /* Buttons */ 74 | 75 | .download-button { 76 | margin: 5% 3% 5% 0; 77 | } 78 | 79 | /* Title Section */ 80 | 81 | #title { 82 | background-color: #00ADB5; 83 | color: #fff; 84 | text-align: left; 85 | } 86 | 87 | 88 | /* Title Image */ 89 | 90 | .title-image { 91 | width: 60%; 92 | transform: rotate(25deg); 93 | position: absolute; 94 | right: 30%; 95 | } 96 | 97 | /* Features Section */ 98 | 99 | #features { 100 | position: relative; 101 | } 102 | 103 | .feature-title { 104 | font-size: 1.5rem; 105 | color: #000; 106 | } 107 | .feature-desc{ 108 | color:#000; 109 | } 110 | .feature-box { 111 | padding: 4.5%; 112 | } 113 | 114 | .icon { 115 | color: #71C9CE; 116 | margin-bottom: 1rem; 117 | } 118 | 119 | .icon:hover { 120 | color: #00ADB5; 121 | } 122 | 123 | /* Testimonial Section */ 124 | 125 | #testimonials { 126 | background-color: #71C9CE; 127 | } 128 | 129 | .testimonial-text { 130 | font-size: 3rem; 131 | line-height: 1.5; 132 | } 133 | 134 | .testimonial-image { 135 | width: 10%; 136 | border-radius: 100%; 137 | margin: 20px; 138 | } 139 | 140 | 141 | #press { 142 | background-color: #71C9CE; 143 | padding-bottom: 3%; 144 | } 145 | 146 | .press-logo { 147 | width: 15%; 148 | margin: 20px 20px 50px; 149 | } 150 | 151 | /* Pricing Section */ 152 | 153 | #pricing { 154 | padding: 100px; 155 | } 156 | 157 | .price-text { 158 | font-size: 3rem; 159 | line-height: 1.5; 160 | } 161 | 162 | .pricing-column { 163 | padding: 3% 2%; 164 | } 165 | 166 | /* CTA Section */ 167 | 168 | 169 | /* Footer Section */ 170 | 171 | 172 | .social-icon { 173 | margin: 20px 10px; 174 | } 175 | 176 | @media (max-width: 1028px) { 177 | 178 | #title { 179 | text-align: center; 180 | } 181 | 182 | .title-image { 183 | position: static; 184 | transform: rotate(0); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /public/css/iphone6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/public/css/iphone6.png -------------------------------------------------------------------------------- /public/css/sohail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/public/css/sohail.jpg -------------------------------------------------------------------------------- /public/css/styles.css: -------------------------------------------------------------------------------- 1 | @import "https://use.fontawesome.com/releases/v5.5.0/css/all.css"; 2 | body{ 3 | margin: 0; 4 | padding: 0; 5 | font-family: sans-serif; 6 | background-color: #00ADB5; 7 | background-size: cover; 8 | font-family: "Montserrat"; 9 | text-align: center; 10 | 11 | } 12 | 13 | 14 | .container-fluid{ 15 | padding: 1% 7%; 16 | } 17 | 18 | 19 | #title .container-fluid { 20 | padding: 3% 7% 0.01%; 21 | } 22 | 23 | .navbar { 24 | padding: 0 0 4.5rem; 25 | } 26 | 27 | .navbar-brand { 28 | font-family: "Ubuntu"; 29 | font-size: 2.5rem; 30 | font-weight: bold; 31 | } 32 | 33 | .nav-item { 34 | padding: 0 18px; 35 | } 36 | 37 | .nav-link { 38 | font-size: 1.2rem; 39 | font-family: "Montserrat-Light"; 40 | } 41 | 42 | .login-box{ 43 | margin: auto; 44 | } 45 | 46 | 47 | .login-box h1{ 48 | color: #fff; 49 | font-size: 40px; 50 | border-bottom: 6px solid #fff; 51 | margin-bottom: 50px; 52 | padding: 13px 0; 53 | } 54 | 55 | 56 | 57 | 58 | 59 | 60 | .home-page{ 61 | color: white; 62 | width: 75%; 63 | text-align: center; 64 | } 65 | .home-page a{ 66 | width: 20%; 67 | text-align: center; 68 | align-items: center; 69 | } 70 | 71 | .textbox{ 72 | width: 100%; 73 | overflow: hidden; 74 | font-size: 20px; 75 | padding: 8px 0; 76 | margin: 8px 0; 77 | border-bottom: 1px solid #fff; 78 | } 79 | .textbox i{ 80 | width: 26px; 81 | float: left; 82 | text-align: center; 83 | } 84 | .textbox input{ 85 | border: none; 86 | outline: none; 87 | background: none; 88 | color: #fff; 89 | font-size: 18px; 90 | width: 80%; 91 | float: left; 92 | margin: 0 10px; 93 | } 94 | .textbox option{ 95 | border: none; 96 | outline: none; 97 | background: none; 98 | color: #000; 99 | font-size: 18px; 100 | width: 80%; 101 | float: left; 102 | margin: 0 10px; 103 | } 104 | .textbox select{ 105 | border: none; 106 | outline: none; 107 | background: none; 108 | color: #000; 109 | font-size: 18px; 110 | width: 80%; 111 | float: left; 112 | margin: 0 10px; 113 | } 114 | .btn{ 115 | width: 100%; 116 | background: none; 117 | border: 2px solid #fff; 118 | color: white; 119 | padding: 5px; 120 | font-size: 18px; 121 | cursor: pointer; 122 | margin: 12px 0; 123 | } 124 | 125 | .info{ 126 | position: relative; 127 | 128 | margin-top: 50px; 129 | color: white; 130 | text-align: center; 131 | color: antiquewhite; 132 | } 133 | .info-h2{ 134 | padding: 7px; 135 | } 136 | .info p{ 137 | text-align: center; 138 | margin-top: 50px; 139 | margin-left: 10%; 140 | margin-right: 10%; 141 | } 142 | .login-icons{ 143 | float: left; 144 | color: #fff; 145 | } 146 | 147 | .container3 148 | { 149 | padding-left: 6rem; 150 | } 151 | 152 | .card-about 153 | { 154 | border-radius: 20%; 155 | } 156 | 157 | 158 | b{ 159 | font-size: 15; 160 | 161 | } -------------------------------------------------------------------------------- /randomRowPrediction/cnn_fs_bin.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/cnn_fs_bin.h5 -------------------------------------------------------------------------------- /randomRowPrediction/cnn_fs_multi.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/cnn_fs_multi.h5 -------------------------------------------------------------------------------- /randomRowPrediction/knn_fs.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/knn_fs.sav -------------------------------------------------------------------------------- /randomRowPrediction/knn_fs_bin.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/knn_fs_bin.sav -------------------------------------------------------------------------------- /randomRowPrediction/lstm_fs_bin_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/lstm_fs_bin_class.h5 -------------------------------------------------------------------------------- /randomRowPrediction/lstm_fs_multi_class.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/lstm_fs_multi_class.h5 -------------------------------------------------------------------------------- /randomRowPrediction/nids_random.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | from sklearn.metrics import accuracy_score, confusion_matrix 4 | import pandas as pd 5 | from sklearn.preprocessing import LabelEncoder 6 | from sklearn.preprocessing import MinMaxScaler 7 | import sklearn 8 | from sklearn.neighbors import KNeighborsClassifier 9 | import os 10 | #from google.colab import drive 11 | from sklearn.preprocessing import LabelEncoder 12 | import tensorflow as tf 13 | import pickle 14 | data_Validate=pd.read_csv('fs_new validation project.csv') 15 | columns = (['protocol_type','service','flag','logged_in','count','srv_serror_rate','srv_rerror_rate','same_srv_rate','diff_srv_rate','dst_host_count','dst_host_srv_count','dst_host_same_srv_rate','dst_host_diff_srv_rate','dst_host_same_src_port_rate','dst_host_serror_rate','dst_host_rerror_rate','attack']) 16 | data_Validate.columns=columns 17 | protocol_type_le = LabelEncoder() 18 | service_le = LabelEncoder() 19 | flag_le = LabelEncoder() 20 | data_Validate['protocol_type'] = protocol_type_le.fit_transform(data_Validate['protocol_type']) 21 | data_Validate['service'] = service_le.fit_transform(data_Validate['service']) 22 | data_Validate['flag'] = flag_le.fit_transform(data_Validate['flag']) 23 | df_validate=data_Validate.copy(deep=True) 24 | x_validate=df_validate.drop(['attack'],axis=1) 25 | 26 | label_encoder = LabelEncoder() 27 | scaler=MinMaxScaler() 28 | x1=x_validate.copy(deep=True) 29 | scaler=MinMaxScaler() 30 | scaler.fit(x1) 31 | scaled_data=scaler.transform(x1) 32 | scaled_data=pd.DataFrame(scaled_data) 33 | scaled_data.columns= x1.columns 34 | x_validate=scaled_data 35 | 36 | knn_bin = pickle.load(open('knn_fs_bin.sav', 'rb')) 37 | knn_multi = pickle.load(open('knn_fs.sav', 'rb')) 38 | randfor_bin = pickle.load(open('randomfor_fs_bin.sav', 'rb')) 39 | randfor_multi = pickle.load(open('randomfor_fs_multi.sav', 'rb')) 40 | cnn_bin= tf.keras.models.load_model('cnn_fs_bin.h5') 41 | cnn_multi= tf.keras.models.load_model('cnn_fs_multi.h5') 42 | lstm_bin= tf.keras.models.load_model('lstm_fs_bin_class.h5') 43 | lstm_multi= tf.keras.models.load_model('lstm_fs_multi_class.h5') 44 | 45 | def advance(): 46 | print("KNN ALGORITHM:") 47 | tp=x_validate.sample() 48 | val_knn=knn_bin.predict(tp) 49 | if(val_knn==1): 50 | print('Binary class Type: ATTACK') 51 | tp_knn=knn_multi.predict(tp) 52 | print('Multi class Type:',tp_knn) 53 | if(tp_knn=='dos'): 54 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 55 | elif(tp_knn=='probe'): 56 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 57 | elif(tp_knn=='r2l'): 58 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 59 | elif(tp_knn=='u2r'): 60 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 61 | elif(val_knn==0): 62 | print('Binary class Type: NORMAL') 63 | tp_knn=knn_multi.predict(tp) 64 | print('Multi class Type:',tp_knn) 65 | if(tp_knn=='normal'): 66 | print('this is safe.') 67 | 68 | print("RANDOM FOREST ALGORITHM:") 69 | val_randfor=randfor_bin.predict(tp) 70 | if(val_randfor==1): 71 | print('Binary class Type: ATTACK') 72 | tp_randfor=randfor_multi.predict(tp) 73 | print('Multi class type:',tp_randfor) 74 | if(tp_randfor=='Dos'): 75 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 76 | elif(tp_randfor=='Probe'): 77 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 78 | elif(tp_randfor=='R2L'): 79 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 80 | elif(tp_randfor=='U2R'): 81 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 82 | elif(val_randfor==0): 83 | print('Binary class Type: NORMAL') 84 | tp_randfor=randfor_multi.predict(tp) 85 | print('Multi class Type:',tp_randfor) 86 | if(tp_randfor=='normal'): 87 | print('this is safe.') 88 | 89 | print("CNN ALGORITHM:") 90 | val_cnn=cnn_bin.predict(tp,verbose=0) 91 | for i in val_cnn: 92 | for j in i: 93 | val_cnn=round(j) 94 | if(val_cnn==1): 95 | print('Binary class Type: ATTACK') 96 | tp_cnn=cnn_multi.predict(tp,verbose=0) 97 | l=[] 98 | for i in tp_cnn: 99 | for j in i: 100 | l.append(round(j)) 101 | if(l[1]==1): 102 | print('Multi class Type:Dos') 103 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 104 | elif(l[2]==1): 105 | print('Multi class Type:Probe') 106 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 107 | elif(l[4]==1): 108 | print('Multi class Type:R2L') 109 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 110 | elif(l[3]==1): 111 | print('Multi class Type:U2R') 112 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 113 | elif(l[0]==1): 114 | print('Multi class Type:NORMAL') 115 | print('This is safe') 116 | else: 117 | print("Multi class Type:can't be predicted") 118 | print('Unknown!') 119 | elif(val_cnn==0): 120 | print('Binary class Type: NORMAL') 121 | tp_cnn=cnn_multi.predict(tp,verbose=0) 122 | l=[] 123 | for i in tp_cnn: 124 | for j in i: 125 | l.append(round(j)) 126 | if(l[1]==1): 127 | print('Multi class Type:Dos') 128 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 129 | elif(l[2]==1): 130 | print('Multi class Type:Probe') 131 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 132 | elif(l[4]==1): 133 | print('Multi class Type:R2L') 134 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 135 | elif(l[3]==1): 136 | print('Multi class Type:U2R') 137 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 138 | elif(l[0]==1): 139 | print('Multi class Type:Normal') 140 | print('This is safe') 141 | else: 142 | print("Multi class Type:can't be predicted") 143 | print('Unknown!') 144 | 145 | print("LSTM ALGORITHM:") 146 | val_lstm=lstm_bin.predict(tp,verbose=0) 147 | for i in val_lstm: 148 | for j in i: 149 | val_lstm=round(j) 150 | if(val_lstm==1): 151 | print('Binary class Type: ATTACK') 152 | tp_lstm=lstm_multi.predict(tp,verbose=0) 153 | l=[] 154 | for i in tp_lstm: 155 | for j in i: 156 | l.append(round(j)) 157 | if(l[1]==1): 158 | print('Multi class Type:Dos') 159 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 160 | elif(l[2]==1): 161 | print('Multi class Type:Probe') 162 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 163 | elif(l[4]==1): 164 | print('Multi class Type:R2L') 165 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 166 | elif(l[3]==1): 167 | print('Multi class Type:U2R') 168 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 169 | elif(l[0]==1): 170 | print('Multi class Type:normal') 171 | print('This is safe') 172 | else: 173 | print("Multi class Type:can't be predicted") 174 | print('Unknown!') 175 | elif(round(val_lstm)==0): 176 | print('Binary class Type: NORMAL') 177 | tp_lstm=lstm_multi.predict(tp,verbose=0) 178 | l=[] 179 | for i in tp_lstm: 180 | for j in i: 181 | l.append(round(j)) 182 | if(l[1]==1): 183 | print('Multi class Type:Dos') 184 | print('A Denial-of-Service (DoS) attack is an attack meant to shut down a machine or network, making it inaccessible to its intended users. DoS attacks accomplish this by flooding the target with traffic, or sending it information that triggers a crash. In both instances, the DoS attack deprives legitimate users (i.e. employees, members, or account holders) of the service or resource they expected.') 185 | elif(l[2]==1): 186 | print('Multi class Type:Probe') 187 | print('Probing is another type of attack in which the intruder scans network devices to determine weakness in topology design or some opened ports and then use them in the future for illegal access to personal information.') 188 | elif(l[4]==1): 189 | print('Multi class Type:R2L') 190 | print('Remote to user (R2L) is a type of computer network attacks, in which an intruder sends set of packets to another computer or server over a network where he/she does not have permission to access as a local user.') 191 | elif(l[3]==1): 192 | print('Multi class Type:U2R') 193 | print('User to root attacks (U2R) is an another type of attack where the intruder tries to access the network resources as a normal user, and after several attempts, the intruder becomes as a full access user.') 194 | elif(l[0]==1): 195 | print('Multi class Type:normal') 196 | print('This is safe') 197 | else: 198 | print("Multi class Type:can't be predicted") 199 | print('Unknown!') 200 | 201 | advance() 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /randomRowPrediction/randomfor_fs_bin.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/randomfor_fs_bin.sav -------------------------------------------------------------------------------- /randomRowPrediction/randomfor_fs_multi.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/randomRowPrediction/randomfor_fs_multi.sav -------------------------------------------------------------------------------- /random_forest_binary_class.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/random_forest_binary_class.sav -------------------------------------------------------------------------------- /random_forest_multi_class.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/random_forest_multi_class.sav -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MohdSaif-1807/Network-Intrusion-Detection-System-Using-Machine-Learning-and-Deep-Learning/648d2867366d785f0b3068297aa397bf48ca083b/requirements.txt -------------------------------------------------------------------------------- /views/about.ejs: -------------------------------------------------------------------------------- 1 | <%- include('partials/header') %> 2 | <%-include('partials/loadhead') %> 3 |
4 | 5 | 6 | 7 | 102 | 103 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |Convert the traffic into multiple network parameter patterns (Signatures)
78 |Prevent System acts based on the threat detected
83 |Report/Log the threat
88 |Classify the threat based on signature matching
93 |Match the input network signature against already available normal traffic fignature to detect the zero-day attacks
98 |Match the input signature against the already available threat signature patterns
103 |It will take the network parameters from the user and predict the type of attack.
91 | Predict 92 |