splaaaash commited on
Commit
30aef44
·
verified ·
1 Parent(s): 4691817

Add canonical CIC-IDS-2017 parquet (flowprep) + dataset card

Browse files
Files changed (3) hide show
  1. README.md +232 -0
  2. data/cic-ids-2017-canonical.parquet +3 -0
  3. make_dataset.sh +25 -0
README.md CHANGED
@@ -2,4 +2,236 @@
2
  license: other
3
  license_name: cic-ids-2017-research-use
4
  license_link: https://www.unb.ca/cic/datasets/ids-2017.html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: other
3
  license_name: cic-ids-2017-research-use
4
  license_link: https://www.unb.ca/cic/datasets/ids-2017.html
5
+ pretty_name: CIC-IDS-2017 — Canonical NetFlow (flowprep)
6
+ language:
7
+ - en
8
+ task_categories:
9
+ - tabular-classification
10
+ tags:
11
+ - network-security
12
+ - cybersecurity
13
+ - netflow
14
+ - flow
15
+ - intrusion-detection
16
+ - nids
17
+ - canonical-schema
18
+ - flowprep
19
+ - deeptempo
20
+ size_categories:
21
+ - 100K<n<1M
22
+ configs:
23
+ - config_name: default
24
+ data_files:
25
+ - split: train
26
+ path: data/cic-ids-2017-canonical.parquet
27
+ dataset_info:
28
+ config_name: default
29
+ features:
30
+ - name: timestamp
31
+ dtype: int64
32
+ - name: src_ip
33
+ dtype: string
34
+ - name: dest_ip
35
+ dtype: string
36
+ - name: src_port
37
+ dtype: int32
38
+ - name: dest_port
39
+ dtype: int32
40
+ - name: fwd_bytes
41
+ dtype: int64
42
+ - name: bwd_bytes
43
+ dtype: int64
44
+ - name: fwd_pkts
45
+ dtype: int64
46
+ - name: bwd_pkts
47
+ dtype: int64
48
+ - name: flow_dur
49
+ dtype: float64
50
+ - name: protocol
51
+ dtype: int32
52
+ - name: attack
53
+ dtype: string
54
+ - name: label
55
+ dtype: string
56
+ splits:
57
+ - name: train
58
+ num_examples: 101094
59
  ---
60
+
61
+ # CIC-IDS-2017 — Canonical NetFlow (flowprep)
62
+
63
+ A ~101k-row slice of the **CIC-IDS-2017** intrusion-detection dataset, normalized
64
+ into a single clean, typed, unit-normalized **canonical NetFlow** parquet table by
65
+ [**flowprep**](https://github.com/DeepTempo/flowprep) — the open-source flow
66
+ canonicalization tool DeepTempo runs in production ahead of inference.
67
+
68
+ This is a **conversion proof-point**: it shows what a real, messy research dataset
69
+ looks like after `flowprep canonicalize` resolves its vendor column names, infers
70
+ its units, and types its columns. The output is ordinary parquet —
71
+ `pandas`/`polars`/`DuckDB`/Spark read it natively, **the file format is the API**.
72
+
73
+ > ⚠️ This is a **small demonstration slice**, not the full CIC-IDS-2017 dataset.
74
+ > For research, obtain the complete dataset from
75
+ > [UNB CIC](https://www.unb.ca/cic/datasets/ids-2017.html) and cite accordingly
76
+ > (see [Citation](#citation)).
77
+
78
+ ## Why this exists
79
+
80
+ Every network-ML project and SOC pipeline starts by solving the same unglamorous
81
+ problem: flow data arrives with different column names, duration units, and
82
+ timestamp encodings. The same field is `src_ip`, `Source IP`, `srcaddr`, or
83
+ `ipv4_src_addr`; a duration might be seconds, ms, µs, or ns with nothing telling
84
+ you which. flowprep maps 100+ column spellings onto one canonical schema and
85
+ normalizes units, so labeled research data stays labeled and is ready to train on
86
+ immediately. This dataset is that step, done once, published.
87
+
88
+ ## How it was produced
89
+
90
+ Fully reproducible from the sample bundled in the flowprep repo (no network access
91
+ required):
92
+
93
+ ```bash
94
+ git clone https://github.com/DeepTempo/flowprep
95
+ cd flowprep
96
+ cargo build --release
97
+
98
+ # aliased CIC columns (total_fwd_pkts, datetime timestamps) -> canonical schema
99
+ ./target/release/flowprep canonicalize \
100
+ examples/cic2017_sample.parquet \
101
+ cic-ids-2017-canonical.parquet
102
+ # -> Wrote 101094 flows
103
+ ```
104
+
105
+ `flowprep` resolved the source's CIC-style aliases (e.g. `total_fwd_pkts` →
106
+ `fwd_pkts`, `total_bwd_pkts` → `bwd_pkts`), converted the typed-datetime
107
+ `timestamp` to int64 epoch microseconds, kept `flow_dur` in float64 seconds, and
108
+ passed the ground-truth label columns through unchanged. The alias map is not
109
+ hard-coded — it is loaded at compile time from flowprep's declarative
110
+ [`schemas/netflow/v1/schema.json`](https://github.com/DeepTempo/flowprep/blob/main/schemas/netflow/v1/schema.json),
111
+ the same artifact DeepTempo's production ingestion uses. Output is single-row-group
112
+ ZSTD-compressed parquet.
113
+
114
+ ## Schema
115
+
116
+ | field | type | unit / encoding | description |
117
+ |---|---|---|---|
118
+ | `timestamp` | int64 | epoch **microseconds** | flow start time |
119
+ | `src_ip` | string | | source IP |
120
+ | `dest_ip` | string | | destination IP |
121
+ | `src_port` | int32 | | source L4 port |
122
+ | `dest_port` | int32 | | destination L4 port |
123
+ | `fwd_bytes` | int64 | bytes | source→destination bytes |
124
+ | `bwd_bytes` | int64 | bytes | destination→source bytes |
125
+ | `fwd_pkts` | int64 | packets | source→destination packets |
126
+ | `bwd_pkts` | int64 | packets | destination→source packets |
127
+ | `flow_dur` | float64 | **seconds** | flow duration |
128
+ | `protocol` | int32 | IANA number | **null in this slice** — the CIC sample carries no protocol field; kept for canonical-schema fidelity |
129
+ | `attack` | string | `benign` / `attack` | ground-truth label (string) |
130
+ | `label` | string | `0` / `1` | ground-truth label (binary, string-encoded) |
131
+
132
+ `attack` and `label` are two encodings of the same binary ground truth and are
133
+ preserved exactly as flowprep emitted them (label passthrough). This slice does
134
+ **not** carry per-attack subtype labels (DoS, PortScan, …).
135
+
136
+ ## Statistics
137
+
138
+ - **Rows:** 101,094 flows
139
+ - **Class balance:** 81,171 benign (80.29%) / 19,923 attack (19.71%)
140
+ - **Unique source IPs:** 4,656 · **unique destination IPs:** 7,254
141
+ - **Timestamp range (as stored, passed through from source):** 2017-03-07 →
142
+ 2017-07-07 UTC. CIC-IDS-2017 was captured over a work week in July 2017; the
143
+ exact values here are the source sample's timestamps, unchanged by flowprep.
144
+ - **`flow_dur`:** 0 – 120.0 s (mean 14.84 s)
145
+ - **`fwd_bytes`:** 0 – 1,034,689 (mean 527) · **`bwd_bytes`:** 0 – 538,000,000 (mean 16,097)
146
+ - **`fwd_pkts`:** 1 – 180,725 (mean 9.4) · **`bwd_pkts`:** 0 – 242,974 (mean 10.5)
147
+ - **File:** `data/cic-ids-2017-canonical.parquet` (~1.7 MB, ZSTD, single row group)
148
+
149
+ ## Usage
150
+
151
+ ```python
152
+ import pandas as pd
153
+ df = pd.read_parquet("hf://datasets/<org>/cic-ids-2017-flowprep/data/cic-ids-2017-canonical.parquet")
154
+ # that's the whole integration — no bindings, no client library
155
+
156
+ # binary label for training/eval
157
+ y = (df["label"] == "1").astype(int)
158
+ ```
159
+
160
+ ```python
161
+ # or with the datasets library
162
+ from datasets import load_dataset
163
+ ds = load_dataset("<org>/cic-ids-2017-flowprep", split="train")
164
+ ```
165
+
166
+ ```python
167
+ import duckdb
168
+ duckdb.sql("SELECT attack, count(*) FROM 'data/cic-ids-2017-canonical.parquet' GROUP BY attack")
169
+ ```
170
+
171
+ ## Intended use
172
+
173
+ - A small, clean, **labeled** flow table for prototyping NIDS / flow-classification
174
+ models and for **reproducible evaluation** (the canonical schema removes
175
+ preprocessing variance — a documented source of up to ~40% metric swing across
176
+ NIDS papers).
177
+ - A worked example of canonical NetFlow for the new generation of **network
178
+ foundation models**, which expect one stable, unit-normalized schema.
179
+ - A reference for what flowprep output looks like before you point it at your own
180
+ pcap / nfdump / OCSF / CSV sources.
181
+
182
+ ## Limitations & honest notes
183
+
184
+ - **Not the full dataset.** A ~101k-flow demonstration slice; not class-complete
185
+ and not a substitute for the official CIC-IDS-2017 release.
186
+ - **Binary labels only.** `attack`/`label` are benign-vs-attack; no per-attack
187
+ subtype is present in this slice.
188
+ - **`protocol` is null** (the source sample has no protocol field); the column is
189
+ retained only for canonical-schema fidelity.
190
+ - **Timestamps are passed through** from the source unchanged; treat them as
191
+ relative ordering, not authoritative wall-clock capture times.
192
+ - **Known CIC-IDS-2017 caveats apply.** The original dataset has documented
193
+ labeling and generation issues discussed in the literature; do not treat results
194
+ on this slice as production detection performance.
195
+
196
+ ## License & attribution
197
+
198
+ The **canonical parquet artifact and this dataset card** are released by DeepTempo;
199
+ the **flowprep tool** that produced it is [Apache-2.0](https://github.com/DeepTempo/flowprep/blob/main/LICENSE).
200
+
201
+ The underlying flow data **derives from CIC-IDS-2017**, © Canadian Institute for
202
+ Cybersecurity (CIC), University of New Brunswick. It is redistributed here as a
203
+ small conversion example, **with attribution and citation as required by CIC**. For
204
+ research use, obtain the full dataset from
205
+ [UNB CIC](https://www.unb.ca/cic/datasets/ids-2017.html) and cite the paper below.
206
+ If you are a rights holder and have concerns about this slice, please open an issue
207
+ on the [flowprep repo](https://github.com/DeepTempo/flowprep).
208
+
209
+ ## Citation
210
+
211
+ If you use this data, cite the original CIC-IDS-2017 paper:
212
+
213
+ ```bibtex
214
+ @inproceedings{sharafaldin2018toward,
215
+ title = {Toward Generating a New Intrusion Detection Dataset and Intrusion Traffic Characterization},
216
+ author = {Sharafaldin, Iman and Lashkari, Arash Habibi and Ghorbani, Ali A.},
217
+ booktitle = {Proceedings of the 4th International Conference on Information Systems Security and Privacy (ICISSP)},
218
+ year = {2018}
219
+ }
220
+ ```
221
+
222
+ And, optionally, the tool used to canonicalize it:
223
+
224
+ ```bibtex
225
+ @software{flowprep,
226
+ title = {flowprep: network telemetry to ML-ready canonical NetFlow parquet},
227
+ author = {DeepTempo},
228
+ url = {https://github.com/DeepTempo/flowprep},
229
+ year = {2026}
230
+ }
231
+ ```
232
+
233
+ ## Acknowledgments
234
+
235
+ - **Canonical Institute for Cybersecurity (UNB)** for CIC-IDS-2017.
236
+ - Built with [**flowprep**](https://github.com/DeepTempo/flowprep) by
237
+ [DeepTempo](https://deeptempo.ai).
data/cic-ids-2017-canonical.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25160b9a5a7b72ebe36775b834cf2d646a00a02b16fcdda33c6796c16c864b1f
3
+ size 1740286
make_dataset.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Reproduce the canonical CIC-IDS-2017 parquet from the flowprep example slice.
3
+ # No network access required. Run from anywhere; paths are resolved relative to
4
+ # this script and the flowprep repo at ../../../oss/flowprep.
5
+ set -euo pipefail
6
+ cd "$(dirname "$0")"
7
+
8
+ FLOWPREP_DIR="../../../oss/flowprep"
9
+ BIN="$FLOWPREP_DIR/target/release/flowprep"
10
+ SRC="$FLOWPREP_DIR/examples/cic2017_sample.parquet"
11
+ OUT="data/cic-ids-2017-canonical.parquet"
12
+
13
+ if [[ ! -x "$BIN" ]]; then
14
+ echo "Building flowprep release binary..."
15
+ ( cd "$FLOWPREP_DIR" && cargo build --release )
16
+ fi
17
+
18
+ mkdir -p data
19
+ echo "=== canonicalize CIC-IDS-2017 sample -> canonical schema ==="
20
+ "$BIN" canonicalize "$SRC" "$OUT"
21
+ echo
22
+ echo "=== preview ==="
23
+ "$BIN" peek "$OUT" -n 5
24
+ echo
25
+ echo "Wrote $OUT"