add readme, update DecisionTree

This commit is contained in:
2025-05-27 18:24:18 +00:00
parent cc8c27220b
commit 9d1d022721
3 changed files with 52 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 1,
"id": "d5618056", "id": "d5618056",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -18,7 +18,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 2,
"id": "d336971a", "id": "d336971a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@@ -84,7 +84,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 3,
"id": "b96f3403", "id": "b96f3403",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [

19
README.md Normal file
View File

@@ -0,0 +1,19 @@
# Setup
Run `pip install -r requirements.txt`
# Tree Generation
## Download Dataset
Download the *September 22 2016* dataset from: https://iotanalytics.unsw.edu.au/iottraces.html#bib18tmc
Rename the file as data.pcap
## Preprocessing Dataset
Run `ExtractDataset.ipynb`, this will take a few minutes
## Training
Run `DecisionTree.ipynb`, the tree should be output in `tree`

30
tree Normal file
View File

@@ -0,0 +1,30 @@
proto = [0, 1, 11];
src = [26, 60, 67, 130, 283, 1223, 4566, 5225, 54978, 59817, 60043];
dst = [101, 3031, 3067, 5110, 33925, 46329, 46331, 49152, 49157, 51848, 53283, 56320];
when dst<=3031.0 and src<=67.5 and src<=60.0 and proto<=0.5 and src<=26.5 then 17;
when dst<=3031.0 and src<=67.5 and src<=60.0 and proto<=0.5 and src>26.5 then 17;
when dst<=3031.0 and src<=67.5 and src<=60.0 and proto>0.5 and proto<=1.5 then 17;
when dst<=3031.0 and src<=67.5 and src<=60.0 and proto>0.5 and proto>1.5 then 17;
when dst<=3031.0 and src<=67.5 and src>60.0 then 8;
when dst<=3031.0 and src>67.5 and dst<=101.5 and src<=59817.5 and src<=54978.5 then 17;
when dst<=3031.0 and src>67.5 and dst<=101.5 and src<=59817.5 and src>54978.5 then 17;
when dst<=3031.0 and src>67.5 and dst<=101.5 and src>59817.5 and src<=60043.0 then 5;
when dst<=3031.0 and src>67.5 and dst<=101.5 and src>59817.5 and src>60043.0 then 17;
when dst<=3031.0 and src>67.5 and dst>101.5 and src<=130.0 then 17;
when dst<=3031.0 and src>67.5 and dst>101.5 and src>130.0 and src<=1223.5 then 17;
when dst<=3031.0 and src>67.5 and dst>101.5 and src>130.0 and src>1223.5 then 17;
when dst>3031.0 and dst<=49157.0 and dst<=46329.5 and dst<=5110.0 and dst<=3067.5 then 11;
when dst>3031.0 and dst<=49157.0 and dst<=46329.5 and dst<=5110.0 and dst>3067.5 then 1;
when dst>3031.0 and dst<=49157.0 and dst<=46329.5 and dst>5110.0 and dst<=33925.0 then 17;
when dst>3031.0 and dst<=49157.0 and dst<=46329.5 and dst>5110.0 and dst>33925.0 then 15;
when dst>3031.0 and dst<=49157.0 and dst>46329.5 and dst<=46331.5 then 4;
when dst>3031.0 and dst<=49157.0 and dst>46329.5 and dst>46331.5 and dst<=49152.5 then 10;
when dst>3031.0 and dst<=49157.0 and dst>46329.5 and dst>46331.5 and dst>49152.5 then 2;
when dst>3031.0 and dst>49157.0 and src<=4566.5 and src<=283.0 and proto<=11.5 then 17;
when dst>3031.0 and dst>49157.0 and src<=4566.5 and src<=283.0 and proto>11.5 then 0;
when dst>3031.0 and dst>49157.0 and src<=4566.5 and src>283.0 and dst<=56320.0 then 17;
when dst>3031.0 and dst>49157.0 and src<=4566.5 and src>283.0 and dst>56320.0 then 17;
when dst>3031.0 and dst>49157.0 and src>4566.5 and src<=5225.0 and dst<=51848.5 then 10;
when dst>3031.0 and dst>49157.0 and src>4566.5 and src<=5225.0 and dst>51848.5 then 17;
when dst>3031.0 and dst>49157.0 and src>4566.5 and src>5225.0 and dst<=53283.0 then 17;
when dst>3031.0 and dst>49157.0 and src>4566.5 and src>5225.0 and dst>53283.0 then 14;