Skip to main content

High-performance PCAP-to-CSV network flow extractor for edge devices

Project description

pcapflower

High-performance PCAP-to-CSV network flow extractor for edge devices.

Converts .pcap / .pcapng captures into bidirectional flow features compatible with the CICFlowMeter feature set — using a fraction of the memory and CPU.

Why pcapflower?

CICFlowMeter pcapflower
Packet parser Scapy dpkt (~10–25× faster on ARM)
Memory per flow O(n packets) O(1) — Welford's online algorithm
Output buffering 1 syscall/row Batched (1 syscall/500 rows)
pcapng support

Installation

pip install pcapflower

Quick start

from pcapflower import convert_pcap_to_csv

n = convert_pcap_to_csv("capture.pcap", "flows.csv")
print(f"Extracted {n} flows")

API

convert_pcap_to_csv(input_path, output_path, **kwargs) → int

Parameter Default Description
input_path Path to .pcap or .pcapng file
output_path Path for the output .csv (created or overwritten)
flow_timeout 120.0 Seconds of inactivity before a flow is evicted
gc_interval 1000 Run idle-flow GC every N packets
buffer_rows 500 Rows buffered in memory before flushing to disk

Returns the number of flow rows written.

Output features

Each row contains 82 features covering:

  • Flow identity: source/destination IP, port, protocol, timestamp
  • Duration, bytes/s, and packets/s (forward, backward, combined)
  • Packet length statistics (mean, std, min, max, variance)
  • Inter-arrival time statistics (flow, forward, backward)
  • TCP flag counts (FIN, SYN, RST, PSH, ACK, URG, ECE, CWR)
  • Active/idle period statistics
  • Bulk transfer metrics (forward and backward)
  • Subflow metrics
  • Initial TCP window sizes

Supported input formats

  • pcap — standard libpcap format
  • pcapng — next-generation capture format

Only IPv4 TCP and UDP flows are extracted; other protocols are silently skipped.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pcapflower-1.0.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pcapflower-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file pcapflower-1.0.0.tar.gz.

File metadata

  • Download URL: pcapflower-1.0.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pcapflower-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1d2e0839c1a4b52f9848f6a37a8f9784d38c625fd57154319a7ac9ffe05aa592
MD5 a43356f9d94b449aae52e2e85873ff87
BLAKE2b-256 d688a443cd82183b15f020a31cc6e3110e8aa4fd79085be66b1f640fab8d8c49

See more details on using hashes here.

File details

Details for the file pcapflower-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pcapflower-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pcapflower-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cdf30007778b03a4fd27d12ea151e788765031d7f3c2638f79b38f71a46fc6e
MD5 ed7021ede296f6830956f7b53fb0a302
BLAKE2b-256 afa80dcb7a35208fce60dd8820f23ea1c50a303464f0df73481cd55feba7416f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page