diff --git a/DecisionTree.ipynb b/DecisionTree.ipynb index 5cd6a49..add858e 100644 --- a/DecisionTree.ipynb +++ b/DecisionTree.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 4, + "execution_count": 1, "id": "d5618056", "metadata": {}, "outputs": [], @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 2, "id": "d336971a", "metadata": {}, "outputs": [], @@ -84,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 3, "id": "b96f3403", "metadata": {}, "outputs": [ diff --git a/README.md b/README.md new file mode 100644 index 0000000..db766e6 --- /dev/null +++ b/README.md @@ -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` \ No newline at end of file diff --git a/tree b/tree new file mode 100644 index 0000000..dc0161c --- /dev/null +++ b/tree @@ -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;