/CNN_Traffic_Classification

Codes related to Network Traffic Classification with CNN

Primary LanguagePython

๐Ÿ“šCNN Traffic Classification Module

๐Ÿ“–๊ฐœ์š”

๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ ํŠน์ง• ๋ฒกํ„ฐ ์ •๋ณด(์˜ˆ: KDD cup 99, CICIDS2017)๋ฅผ ์ด๋ฏธ์ง€๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ž…๋ ฅ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š”, CNN๊ธฐ๋ฐ˜ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ ๊ณต๊ฒฉ ๋ถ„๋ฅ˜ ๋ชจ๋ธ์„ ํ•™์Šตํ•˜๊ณ  ๊ฒ€์ฆ(3 fold cross validation)ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๋Š” ๋ชจ๋“ˆ.

๐Ÿ“–License

์ด ์ฝ”๋“œ๋Š” ์žฌ๋ฐฐํฌ, ์žฌ๋ฐœํ–‰, ๋ฏธ๋Ÿฌ๋ง ๋ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ๋‹ค์Œ์˜ ๋…ผ๋ฌธ์„ ๊ผญ ์ธ์šฉํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

You may redistribute, republish, and mirror this code in any form. However, any use or redistribution must include a citation to the following paper.

Sungwoong Yeom, Van-Quyet Nguyen and Kyungbaek Kim, Assessing Convolutional Neural Network based Malicious Network Traffic Detection Methods, KNOM REVIEW, Vol. 22, No. 1, pp. 20-29, August, 2019.

๐Ÿ“–Model Process

โœ”๏ธ์ž…๋ ฅ ํŒŒ๋ผ๋ฉ”ํ„ฐ

'-d','--dataset', type=str, help='Training Data Path (necessary)'
'-n','--outputname', type=str, default="", help='Output File Prefix'
'-c','--conv', type=int, default=1, help='Convolution Layer Number'
'-p','--pool', type=int, default=1, help='Max Pooling Layer Number'
'-f','--fcl', type=int, default=1, help='Fully Connected Layer Number'
'--hidden', type=int, default=512, help='Hidden Layer Number'
'--units', type=int, default=100, help='N Hidden Units Value'
'-l','--learning', type=float, default=0.00001, help='Learning Rate Value'
'-i','--iters', type=int, default=10500, help='Training Iters Value'
'-b','--batch', type=int, default=50, help='Batch Size Value'
'--display', type=float, default=10, help='Display Step'
'--dropout', type=float, default=.5, help='Dropout Value'
  • ์ž…๋ ฅ ํŒŒ์ผ: Sample.csv (CICIDS2017 Friday Morning)
  • ์ถœ๋ ฅ ํŒŒ์ผ: Precision, Recall, F1score, Confusion Matrix ์ •๋ณด๋ฅผ ๋‹ด์€ ๊ฒฐ๊ณผ

โœ”๏ธ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ

  1. ๋ฐ์ดํ„ฐ์…‹์—์„œ ๊ณต๋ฐฑ๋ฌธ์ž ์ œ๊ฑฐ ๋ฐ Oulier(16777216=2^82^82^8 ์ด์ƒ์˜ ๊ฐ’)์„ 16777216์œผ๋กœ ๋ณ€ํ™˜
  2. 3-Fold Validation์„ ์ˆ˜ํ–‰ํ•˜์—ฌ ํ•™์Šต ๋ฐ์ดํ„ฐ ๋ฐ ๊ฒ€์ฆ ๋ฐ์ดํ„ฐ๋ฅผ ๊ตฌ๋ถ„
  3. CNN ๋ชจ๋ธ์˜ ์ž…๋ ฅ์„ ์œ„ํ•ด ํ†ต๊ณ„์ ์œผ๋กœ ์ถ”์ถœ๋œ ์•…์„ฑ ํŠธ๋ž˜ํ”ฝ ๋ฐ์ดํ„ฐ ์…‹์„ nxn ํ˜•ํƒœ์˜ Metrix๋กœ ๋ณ€ํ™˜
  • ์ „์ฒ˜๋ฆฌ ํ›„ ์ƒ์„ฑ๋˜๋Š” ๋ฐ์ดํ„ฐ: 9x9 Input Metrix

โœ”๏ธ์•…์„ฑ ํŠธ๋ž˜ํ”ฝ ๋ถ„๋ฅ˜

  • ์ธ๊ณต์ง€๋Šฅ ๋ชจ๋ธ: CNN ๊ธฐ๋ฐ˜ ์•…์„ฑ ํŠธ๋ž˜ํ”ฝ ๋ถ„๋ฅ˜
  • ์ž…๋ ฅ: 78๊ฐœ์˜ ํ†ต๊ณ„์  ํŠน์ง• 9x9 Input Metrix
  • ์ถœ๋ ฅ: ์ •์ƒ(BENIGN), ์•…์„ฑ(Bot) ๋ถ„๋ฅ˜

๐Ÿ“–Dataset Summary

โœ”๏ธCICIDS2017 Friday Morning

  • ์ง€์†์‹œ๊ฐ„, ํŒจํ‚ท ์ˆ˜, ๋ฐ”์ดํŠธ ์ˆ˜, ํŒจํ‚ท ๊ธธ์ด ๋“ฑ๊ณผ ๊ฐ™์€ ํ†ต๊ณ„์  ํŠน์„ฑ 78๊ฐ€์ง€ column์„ ๊ฐ€์ง
  • 3988๊ฐœ์˜ row๋กœ ๊ตฌ์„ฑ (BENIGN: 2022, Bot: 1966)
  • CIC IDS2017 dataset details : https://www.unb.ca/cic/datasets/ids-2017.html