Skip to main content

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

Project description

pcapflower

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
Memory per flow O(n packets) O(1) — Welford's online algorithm
Output buffering ? Batched (1 syscall/500 rows)
Parallelism ✓ — n_jobs parameter
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")

# Use all available CPUs
n = convert_pcap_to_csv("capture.pcap", "flows.csv", n_jobs=-1)

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
n_jobs 1 Worker processes. -1 uses all available CPUs

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.1.0.tar.gz (17.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.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pcapflower-1.1.0.tar.gz
  • Upload date:
  • Size: 17.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.1.0.tar.gz
Algorithm Hash digest
SHA256 928c737cb9299a3de670217f22cd1e718eafbe76f1eaecb74e37f13fe598d27b
MD5 0809021886fd5580b50351ac58af7129
BLAKE2b-256 faa298097fba22851622f5751d01f4f862515a39bf018b684b29cc55222c67db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pcapflower-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 513eefbaf738654eb887c5e098081667a8fcd1ce80251cc55d48fb7fbedc2de1
MD5 cde801a6b8917f19f9ea5af5ee8c87fd
BLAKE2b-256 a443715aac4526e7034c6e42c3f8f00cdb8a18dbfaea34106c380690348b27a1

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