Commit
·
c32bdd8
1
Parent(s):
3c73924
Delete CIC-IDS2017.py
Browse files- CIC-IDS2017.py +0 -65
CIC-IDS2017.py
DELETED
|
@@ -1,65 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import csv
|
| 3 |
-
import datasets
|
| 4 |
-
|
| 5 |
-
_CITATION = """\
|
| 6 |
-
@InProceedings{YourReferenceHere,
|
| 7 |
-
}
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
_DESCRIPTION = """\
|
| 11 |
-
Description of your dataset.
|
| 12 |
-
"""
|
| 13 |
-
|
| 14 |
-
_HOMEPAGE = "https://dataset-homepage/"
|
| 15 |
-
_LICENSE = "Dataset License"
|
| 16 |
-
|
| 17 |
-
_URLS = {
|
| 18 |
-
"Network-Flows": "Network-Flows/CICIDS_Flow.csv",
|
| 19 |
-
"Packet-Fields": "Packet-Fields/Packet_Fields_File_10.csv",
|
| 20 |
-
"Packet-Bytes": "Packet-Bytes/Packet_Bytes_File_10.csv",
|
| 21 |
-
"Payload-Bytes": "Payload-Bytes/Payload_Bytes_File_10.csv",
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
class CICIDS2017(datasets.GeneratorBasedBuilder):
|
| 26 |
-
|
| 27 |
-
VERSION = datasets.Version("1.0.0")
|
| 28 |
-
|
| 29 |
-
BUILDER_CONFIGS = [
|
| 30 |
-
datasets.BuilderConfig(name=config_name, description=f"This part of my dataset covers {config_name}")
|
| 31 |
-
for config_name in _URLS.keys()
|
| 32 |
-
]
|
| 33 |
-
|
| 34 |
-
def _info(self):
|
| 35 |
-
return datasets.DatasetInfo(
|
| 36 |
-
description=_DESCRIPTION,
|
| 37 |
-
features=datasets.Features({
|
| 38 |
-
# TODO: Adjust features according to your dataset
|
| 39 |
-
"flow_id": datasets.Value("int64"),
|
| 40 |
-
"attack_label": datasets.Value("string"),
|
| 41 |
-
# More columns...
|
| 42 |
-
}),
|
| 43 |
-
homepage=_HOMEPAGE,
|
| 44 |
-
license=_LICENSE,
|
| 45 |
-
citation=_CITATION,
|
| 46 |
-
)
|
| 47 |
-
|
| 48 |
-
def _split_generators(self, dl_manager):
|
| 49 |
-
url = f"https://huggingface.co/datasets/rdpahalavan/CIC-IDS2017/blob/main/{_URLS[self.config.name]}"
|
| 50 |
-
downloaded_file = dl_manager.download(url)
|
| 51 |
-
return [
|
| 52 |
-
datasets.SplitGenerator(
|
| 53 |
-
name=datasets.Split.TRAIN,
|
| 54 |
-
gen_kwargs={"filepath": downloaded_file},
|
| 55 |
-
),
|
| 56 |
-
]
|
| 57 |
-
|
| 58 |
-
def _generate_examples(self, filepath):
|
| 59 |
-
with open(filepath, encoding="utf-8") as csv_file:
|
| 60 |
-
csv_reader = csv.DictReader(csv_file)
|
| 61 |
-
for id_, row in enumerate(csv_reader):
|
| 62 |
-
yield id_, {
|
| 63 |
-
'flow_id': row['flow_id'],
|
| 64 |
-
'attack_label': row['attack_label']
|
| 65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|