Skip to content

Commit 4a2580f

Browse files
Feature/prompt for configfile to load and save (#69)
* 🎨 Format * 🚀 Load config file into tui * 🧑‍💻 Add dynamic load and save functionality * 📈 Add a chart showing activity when in csv o… (#70) * 📈 Add a chart showing activity when in csv output mode * 🔇 Update when log mode is debug, chart is not shown * Debian package (#71) * ✏️ Update readme with better logging explanation * 📦 Add debian build dpkg files * 🔇 Disable tui by adding new arg * ✅ Add tests * 🙈 Add debian build files to ignore * 🎨 Format * 🐛 Fix missing padding (#73) * 🐛 Fix missing padding * ➕ Add buffer size for the ipv6, so the buffers are as large as the ipv4 * 🔥 Remove double record * ✨ Add new feature icmp type to ebpf programs * support extension headers IPv6 * review comments * New rustiflow featureset + major feature refactor (#77) * create rustiflow feature set * refactor of features into sub structs * include flow expiration cause and support updating stats on expiration * export icmp code from ebpf * update rustiflow feature set * use microseconds since epoch instead of Datetime to limit memory * set default threads to 5 * update dropped packets * update * extra packet features * update rustiflow features * review comments --------- Co-authored-by: Miel Verkerken <[email protected]> Co-authored-by: Miel Verkerken <[email protected]>
1 parent d6d01a2 commit 4a2580f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+5070
-4449
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ Cargo.lock
1414
# testing files
1515
testing/
1616

17-
rustiflow.toml
17+
rustiflow.toml
18+
19+
/debian/rustiflow/
20+
/debian/rustiflow.debhelper.log
21+
/debian/rustiflow.substvars
22+
/debian/files
23+
/debian/debhelper-build-stamp
24+
/debian/.debhelper/

README.md

Lines changed: 92 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
![banner](figures/banner.jpg)
2+
23
# A Network Traffic Feature Extraction Tool
34

45
## <img src="figures/RustiFlow_nobg.png" width="60px"/> Overview
56

67
This tool is engineered for robust and efficient feature extraction, particularly for applications such as network intrusion detection systems, among others. Leveraging Rust language and eBPF, it excels in processing high volumes of network traffic with remarkable speed and throughput. (When your traffic is already captured, don't worry! It also has a build in pcap reader which is also amazingly fast.) With various pre-defined feature sets and the ability to create custom feature sets, RustiFlow offers a versatile solution for network security applications.
78

8-
<a href="https://github.com/idlab-discover/RustiFlow/actions">![Badge displaying GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/idlab-discover/RustiFlow/rust.yml?logo=github)</a>
9+
<a href="https://github.com/idlab-discover/RustiFlow/actions">![Badge displaying GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/idlab-discover/RustiFlow/rust.yml?logo=github)</a>
910
<a href="https://idlab-discover.github.io/RustiFlow"> ![Badge linking to the project documentation website](https://img.shields.io/website?url=https%3A%2F%2Fidlab-discover.github.io%2FRustiFlow&label=Documentation)</a> <a href="https://github.com/idlab-discover/RustiFlow/blob/main/LICENSE"> ![GitHub license](https://img.shields.io/github/license/idlab-discover/RustiFlow) </a>
1011

11-
![Ubuntu 24](https://img.shields.io/badge/Tested%20on%20ubuntu-purple?logo=ubuntu)
12-
12+
![Ubuntu 24](https://img.shields.io/badge/Tested%20on%20ubuntu-purple?logo=ubuntu)
1313

1414
![Animated image showing network flows](figures/flows.gif)
1515

@@ -27,9 +27,11 @@ See the [wiki](https://github.com/idlab-discover/RustiFlow/wiki) for the differe
2727
## <img src="figures/RustiFlow_nobg.png" width="60px"/> Architecture
2828

2929
### Realtime processing
30+
3031
![RustiFlow Architecture Realtime](figures/realtime.png)
3132

3233
### Offline PCAP processing
34+
3335
![RustiFlow Architecture Offline](figures/offline.png)
3436

3537
## <img src="figures/RustiFlow_nobg.png" width="60px"/> Using the release binary:
@@ -47,21 +49,24 @@ You can then run the binary with the following commands displayed on the [help m
4749

4850
### Using the tui interface:
4951

50-
If you want a more graphical interface, you can use the tui interface by just running `rustiflow` without any arguments. This will open the following interface:
52+
If you want a more graphical interface, you can use the tui interface by just running `rustiflow` without any arguments. This will open a field where you can enter a configuration file you want to edit or you can choose to start new. After that, the following interface will show up:
5153

5254
![The tui interface](figures/tui_rustiflow.GIF)
5355

54-
> **NOTE:** When using the save button, the current selection will be saved to the `rustiflow.toml` file. You can reuse this file with following command:
55-
```bash
56-
rustiflow --config-file rustiflow.toml realtime <interface> [--only-ingress]
57-
```
56+
> **NOTE:** When using the save button, you will be prompted for a filename. You can reuse this file with following command:
57+
58+
```bash
59+
rustiflow --config-file <filename> realtime <interface> [--only-ingress]
60+
```
61+
62+
```bash
63+
rustiflow -c <filename> pcap <path to pcap file>
64+
```
5865

59-
```bash
60-
rustiflow -c rustiflow.toml pcap <path to pcap file>
61-
```
6266
> After saving the configuration file, you can safely reset without changing the configuration file.
6367
6468
### Using the configuration file:
69+
6570
This is an example of a configuration file that you can use to run the tool with the `--config-file` option.
6671

6772
```toml
@@ -78,7 +83,9 @@ export_path = "path/to/output.csv"
7883
header = false
7984
drop_contaminant_features = true
8085
```
86+
8187
Example 2:
88+
8289
```toml
8390
[config]
8491
features = "Nfstream"
@@ -118,6 +125,7 @@ Make sure that you don't use docker desktop and that you don't have it installed
118125
## <img src="figures/RustiFlow_nobg.png" width="60px"/> Installation Guide for development
119126

120127
### Prerequisites:
128+
121129
- **libpcap-dev**:
122130
```sh
123131
sudo apt install libpcap-dev
@@ -133,6 +141,7 @@ Make sure that you don't use docker desktop and that you don't have it installed
133141
```
134142

135143
### bpf Linker Installation:
144+
136145
- **For Linux x86_64**:
137146
```bash
138147
cargo install bpf-linker
@@ -162,83 +171,99 @@ Make sure that you don't use docker desktop and that you don't have it installed
162171

163172
## Running the Project in dev mode
164173

165-
```bash
166-
cargo xtask run -- [OPTIONS] <COMMAND>
167-
```
174+
```bash
175+
cargo xtask run -- [OPTIONS] <COMMAND>
176+
```
168177

169178
## <img src="figures/RustiFlow_nobg.png" width="60px"/> Usage Instructions
170179

171180
### Command Help:
172-
```bash
173-
rustiflow help
174-
```
175-
```bash
176-
Usage: rustiflow [OPTIONS] <COMMAND>
177181

178-
Commands:
179-
realtime Real-time feature extraction
180-
pcap Feature extraction from a pcap file
181-
help Print this message or the help of the given subcommand(s)
182+
```bash
183+
rustiflow help
184+
```
182185

183-
Options:
184-
-c, --config-file <CONFIG_FILE>
185-
Configuration file path
186+
```bash
187+
Usage: rustiflow [OPTIONS] <COMMAND>
186188

187-
-f, --features <FEATURES>
188-
The feature set to use (required if no config file is provided)
189+
Commands:
190+
realtime Real-time feature extraction
191+
pcap Feature extraction from a pcap file
192+
help Print this message or the help of the given subcommand(s)
189193

190-
Possible values:
191-
- basic: A basic flow that stores the basic features of a flow
192-
- cic: Represents the CIC Flow, giving 83 features
193-
- cidds: Represents the CIDDS Flow, giving 10 features
194-
- nfstream: Represents a nfstream inspired flow, giving 69 features
195-
- ntl: Represents the NTL Flow, giving 120 features
196-
- custom: Represents a flow that you can implement yourself
194+
Options:
195+
-c, --config-file <CONFIG_FILE>
196+
Configuration file path
197197

198-
--active-timeout <ACTIVE_TIMEOUT>
199-
The maximum time a flow is allowed to last in seconds (optional)
200-
201-
[default: 3600]
198+
-f, --features <FEATURES>
199+
The feature set to use (required if no config file is provided)
202200

203-
--idle-timeout <IDLE_TIMEOUT>
204-
The maximum time with no packets for a flow in seconds (optional)
205-
206-
[default: 120]
201+
Possible values:
202+
- basic: A basic flow that stores the basic features of a flow
203+
- cic: Represents the CIC Flow, giving 83 features
204+
- cidds: Represents the CIDDS Flow, giving 10 features
205+
- nfstream: Represents a nfstream inspired flow, giving 69 features
206+
- rustiflow: Represents the Rusti Flow, giving 120 features
207+
- custom: Represents a flow that you can implement yourself
207208

208-
--early-export <EARLY_EXPORT>
209-
The print interval for open flows in seconds (optional)
209+
--active-timeout <ACTIVE_TIMEOUT>
210+
The maximum time a flow is allowed to last in seconds (optional)
210211

211-
--expiration-check-interval <EXPIRATION_CHECK_INTERVAL>
212-
Interval (in seconds) for checking and expiring flows in the flowtable. This represents how often the flowtable should be scanned to remove inactive flows
213-
214-
[default: 60]
212+
[default: 3600]
215213

216-
--threads <THREADS>
217-
The numbers of threads to use for processing packets (optional) (default: number of logical CPUs)
214+
--idle-timeout <IDLE_TIMEOUT>
215+
The maximum time with no packets for a flow in seconds (optional)
218216

219-
-o, --output <OUTPUT>
220-
Output method (required if no config file is provided)
217+
[default: 120]
221218

222-
Possible values:
223-
- print: The output will be printed to the console
224-
- csv: The output will be written to a CSV file
219+
--early-export <EARLY_EXPORT>
220+
The print interval for open flows in seconds (optional)
225221

226-
--export-path <EXPORT_PATH>
227-
File path for output (used if method is Csv)
222+
--expiration-check-interval <EXPIRATION_CHECK_INTERVAL>
223+
Interval (in seconds) for checking and expiring flows in the flowtable. This represents how often the flowtable should be scanned to remove inactive flows
228224

229-
--header
230-
Whether to export the feature header
225+
[default: 60]
231226

232-
--drop-contaminant-features
233-
Whether to drop contaminant features
227+
--threads <THREADS>
228+
The numbers of threads to use for processing packets (optional) (default: 5, maximum number of logical CPUs)
234229

235-
-h, --help
236-
Print help (see a summary with '-h')
230+
-o, --output <OUTPUT>
231+
Output method (required if no config file is provided)
237232

238-
-V, --version
239-
Print version
233+
Possible values:
234+
- print: The output will be printed to the console
235+
- csv: The output will be written to a CSV file
240236

241-
```
237+
--export-path <EXPORT_PATH>
238+
File path for output (used if method is Csv)
239+
240+
--header
241+
Whether to export the feature header
242+
243+
--drop-contaminant-features
244+
Whether to drop contaminant features
245+
246+
-h, --help
247+
Print help (see a summary with '-h')
248+
249+
-V, --version
250+
Print version
251+
252+
```
253+
254+
## Logging in both development or using the binary
255+
256+
### Development
257+
258+
```bash
259+
RUST_LOG=info cargo xtask run --
260+
```
261+
262+
### Binary
263+
264+
```bash
265+
sudo RUST_LOG=info rustiflow
266+
```
242267
243268
**Note:** For specific logging levels, adjust `RUST_LOG` to `error` for error messages, and `debug` for debug messages. If you don't want any additional logs, just remove `RUST_LOG=info`.
244269

0 commit comments

Comments
 (0)