Skip to main content

Python CICFlowMeter

This project is not maintained actively by me. If you found something wrong (bugs, incorrect results) feel free to create issues or pull requests.


⚡️ Version 0.4.0: Major Refactor (June 2025)

  • The tool now uses a custom FlowSession and the prn callback of Scapy's AsyncSniffer for all flow processing, instead of relying on Scapy's DefaultSession/session system.
  • All flow logic, feature extraction, and output are now fully managed by the project code, not by Scapy internals.
  • The process method always returns None, preventing unwanted packet printing by Scapy.
  • Logging is robust: only shows debug output if -v is set.
  • All flows are always flushed at the end, even for small pcaps.
  • This project is a CICFlowMeter-like tool (see UNB CICFlowMeter), not Cisco NetFlow. It extracts custom flow features as in the original Java CICFlowMeter.
  • The refactor does not change the set of features/fields extracted, only how packets are routed to your logic.

Installation

git clone https://github.com/hieulw/cicflowmeter
cd cicflowmeter
uv sync
source .venv/bin/activate

Usage

usage: cicflowmeter [-h] (-i INPUT_INTERFACE | -f INPUT_FILE | -d INPUT_DIRECTORY) (-c | -u) [--fields FIELDS] [--merge] [-v] output

positional arguments:
  output                output file name (in csv mode), url (in url mode), or output directory (in directory mode)

options:
  -h, --help            show this help message and exit
  -i INPUT_INTERFACE, --interface INPUT_INTERFACE
                        capture online data from INPUT_INTERFACE
  -f INPUT_FILE, --file INPUT_FILE
                        capture offline data from INPUT_FILE
  -d INPUT_DIRECTORY, --directory INPUT_DIRECTORY
                        capture offline data from all pcap files in INPUT_DIRECTORY
  -c, --csv             output flows as csv
  -u, --url             output flows as request to url
  --fields FIELDS       comma separated fields to include in output (default: all)
  --merge               merge all pcap files into a single CSV (only works with -d/--directory mode)
  -v, --verbose         more verbose

Convert pcap file to flow csv:

cicflowmeter -f example.pcap -c flows.csv

Convert all PCAP files in a directory (separate CSVs)

cicflowmeter -d ./pcap_folder/ -c ./csv_output/

Convert all PCAP files in a directory (merged into single CSV)

cicflowmeter -d ./pcap_folder/ -c ./csv_output/ --merge

Sniff packets real-time from interface to flow request: (need root permission)

cicflowmeter -i eth0 -u http://localhost:8080/predict

References:

  1. https://www.unb.ca/cic/research/applications.html#CICFlowMeter
  2. https://github.com/ahlashkari/CICFlowMeter

Release files for cicflowmeter 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cicflowmeter 0.5.0
File Size Uploaded
cicflowmeter-0.5.0.tar.gz 31.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cicflowmeter 0.5.0
File Interpreter ABI Platform
cicflowmeter-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.3 kB

Release files / cicflowmeter-0.5.0.tar.gz

Download URL cicflowmeter-0.5.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
501d8b78ca6b95a1d1300bf5f9424bbfa1f359d188e0af960920586b4a0d4f0e
BLAKE2b-256 checksum
How to use checksums
da2061f2285a6bae616a2412c2fc1eb5b95296e10ceaa69fcd78011dfa82f612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / cicflowmeter-0.5.0-py3-none-any.whl

Download URL cicflowmeter-0.5.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5aabcbb05651261b2c34171aa041015f55673cddda01dc8a6f7508976795c361
BLAKE2b-256 checksum
How to use checksums
38445c3b39d14836398334513647c975ed797b6a393cfd719895210c61070fc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

3 release files

0.1.1

3 release files

0.0.2

3 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page