mirror of
https://github.com/ltcptgeneral/IdealRMT-DecisionTrees.git
synced 2025-09-04 06:17:24 +00:00
display decision tree
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
data.*
|
||||
data.*
|
||||
__pycache__
|
||||
tree.tree
|
File diff suppressed because one or more lines are too long
@@ -12,41 +12,10 @@
|
||||
"import pandas as pd\n",
|
||||
"import argparse\n",
|
||||
"import os\n",
|
||||
"from labels import mac_to_label\n",
|
||||
"\n",
|
||||
"inputfile = \"data.pcap\"\n",
|
||||
"outputfile = \"data.csv\"\n",
|
||||
"\n",
|
||||
"mac_to_device = {\n",
|
||||
" \"44:65:0d:56:cc:d3\": \"Amazon Echo\",\n",
|
||||
" \"e0:76:d0:3f:00:ae\": \"August Doorbell Cam\",\n",
|
||||
" \"70:88:6b:10:0f:c6\": \"Awair air quality monitor\",\n",
|
||||
" \"b4:75:0e:ec:e5:a9\": \"Belkin Camera\",\n",
|
||||
" \"ec:1a:59:83:28:11\": \"Belkin Motion Sensor\",\n",
|
||||
" \"ec:1a:59:79:f4:89\": \"Belkin Switch\",\n",
|
||||
" \"74:6a:89:00:2e:25\": \"Blipcare BP Meter\",\n",
|
||||
" \"7c:70:bc:5d:5e:dc\": \"Canary Camera\",\n",
|
||||
" \"30:8c:fb:2f:e4:b2\": \"Dropcam\",\n",
|
||||
" \"6c:ad:f8:5e:e4:61\": \"Google Chromecast\",\n",
|
||||
" \"28:c2:dd:ff:a5:2d\": \"Hello Barbie\",\n",
|
||||
" \"70:5a:0f:e4:9b:c0\": \"HP Printer\",\n",
|
||||
" \"74:c6:3b:29:d7:1d\": \"iHome PowerPlug\",\n",
|
||||
" \"d0:73:d5:01:83:08\": \"LiFX Bulb\",\n",
|
||||
" \"18:b4:30:25:be:e4\": \"NEST Smoke Sensor\",\n",
|
||||
" \"70:ee:50:18:34:43\": \"Netatmo Camera\",\n",
|
||||
" \"70:ee:50:03:b8:ac\": \"Netatmo Weather station\",\n",
|
||||
" \"00:17:88:2b:9a:25\": \"Phillip Hue Lightbulb\",\n",
|
||||
" \"e0:76:d0:33:bb:85\": \"Pixstart photo frame\",\n",
|
||||
" \"88:4a:ea:31:66:9d\": \"Ring Door Bell\",\n",
|
||||
" \"00:16:6c:ab:6b:88\": \"Samsung Smart Cam\",\n",
|
||||
" \"d0:52:a8:00:67:5e\": \"Smart Things\",\n",
|
||||
" \"f4:f2:6d:93:51:f1\": \"TP-Link Camera\",\n",
|
||||
" \"50:c7:bf:00:56:39\": \"TP-Link Plug\",\n",
|
||||
" \"18:b7:9e:02:20:44\": \"Triby Speaker\",\n",
|
||||
" \"00:24:e4:10:ee:4c\": \"Withings Baby Monitor\",\n",
|
||||
" \"00:24:e4:1b:6f:96\": \"Withings Scale\",\n",
|
||||
" \"00:24:e4:20:28:c6\": \"Withings sleep sensor\",\n",
|
||||
" \"00:24:e4:11:18:a8\": \"Withings\"\n",
|
||||
"}"
|
||||
"outputfile = \"data.csv\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -87,8 +56,8 @@
|
||||
"\n",
|
||||
" if \"Ether\" in packet:\n",
|
||||
" eth_dst = packet[\"Ether\"].dst\n",
|
||||
" if eth_dst in mac_to_device:\n",
|
||||
" classification = mac_to_device[eth_dst]\n",
|
||||
" if eth_dst in mac_to_label:\n",
|
||||
" classification = mac_to_label[eth_dst]\n",
|
||||
" else:\n",
|
||||
" classification = \"other\"\n",
|
||||
" else:\n",
|
||||
|
31
labels.py
Normal file
31
labels.py
Normal file
@@ -0,0 +1,31 @@
|
||||
mac_to_label = {
|
||||
"44:65:0d:56:cc:d3": "Amazon Echo",
|
||||
"e0:76:d0:3f:00:ae": "August Doorbell Cam",
|
||||
"70:88:6b:10:0f:c6": "Awair air quality monitor",
|
||||
"b4:75:0e:ec:e5:a9": "Belkin Camera",
|
||||
"ec:1a:59:83:28:11": "Belkin Motion Sensor",
|
||||
"ec:1a:59:79:f4:89": "Belkin Switch",
|
||||
"74:6a:89:00:2e:25": "Blipcare BP Meter",
|
||||
"7c:70:bc:5d:5e:dc": "Canary Camera",
|
||||
"30:8c:fb:2f:e4:b2": "Dropcam",
|
||||
"6c:ad:f8:5e:e4:61": "Google Chromecast",
|
||||
"28:c2:dd:ff:a5:2d": "Hello Barbie",
|
||||
"70:5a:0f:e4:9b:c0": "HP Printer",
|
||||
"74:c6:3b:29:d7:1d": "iHome PowerPlug",
|
||||
"d0:73:d5:01:83:08": "LiFX Bulb",
|
||||
"18:b4:30:25:be:e4": "NEST Smoke Sensor",
|
||||
"70:ee:50:18:34:43": "Netatmo Camera",
|
||||
"70:ee:50:03:b8:ac": "Netatmo Weather station",
|
||||
"00:17:88:2b:9a:25": "Phillip Hue Lightbulb",
|
||||
"e0:76:d0:33:bb:85": "Pixstart photo frame",
|
||||
"88:4a:ea:31:66:9d": "Ring Door Bell",
|
||||
"00:16:6c:ab:6b:88": "Samsung Smart Cam",
|
||||
"d0:52:a8:00:67:5e": "Smart Things",
|
||||
"f4:f2:6d:93:51:f1": "TP-Link Camera",
|
||||
"50:c7:bf:00:56:39": "TP-Link Plug",
|
||||
"18:b7:9e:02:20:44": "Triby Speaker",
|
||||
"00:24:e4:10:ee:4c": "Withings Baby Monitor",
|
||||
"00:24:e4:1b:6f:96": "Withings Scale",
|
||||
"00:24:e4:20:28:c6": "Withings sleep sensor",
|
||||
"00:24:e4:11:18:a8": "Withings"
|
||||
}
|
@@ -2,4 +2,5 @@ scapy
|
||||
numpy
|
||||
pandas
|
||||
scikit-learn
|
||||
pydotplus
|
||||
pydotplus
|
||||
matplotlib
|
30
tree
30
tree
@@ -1,30 +0,0 @@
|
||||
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;
|
Reference in New Issue
Block a user