Skip to main content

A flexible and powerful network data analysis library

Project description

build coverage quality doc download release python platform license

nfstream is a flexible and lightweight network data analysis library.

nfstream main features

  • Performance: nfstream was designed to be fast with a small CPU and memory footprint.

  • Layer-7 visibility: nfstream dissection is based on nDPI (~300 applications including Tor, Messenger, WhatsApp, etc.).

  • Flexibility: add a flow metric in 2 lines of code using nfstream plugins method.

  • Machine Learning oriented: add your trained model as an NFStreamClassifier.

Use

  • Dealing with a big pcap file and just want to aggregate it as network flows? nfstream make this path easier in few lines:

from nfstream.streamer import Streamer
my_capture_streamer = Streamer(source="instagram.pcap") # or capture from a network interface
for flow in my_capture_streamer:  # or for flow in my_live_streamer
    print(flow)  # print, append to pandas Dataframe or whatever you want :)!
{"ip_src": "192.168.43.18",
 "src_port": 52066,
 "ip_dst": "66.220.156.68",
 "dst_port": 443,
 "ip_protocol": 6,
 "vlan_id": 0,
 "src_to_dst_pkts": 9,
 "dst_to_src_pkts": 10,
 "src_to_dst_bytes": 1345,
 "dst_to_src_bytes": 4400,
 "syn_count": [1, 1],
 "cwr_count": [0, 0],
 "ece_count": [0, 0],
 "urg_count": [0, 0],
 "ack_count": [8, 10],
 "psh_count": [4, 5],
 "rst_count": [0, 0],
 "fin_count": [0, 0],
 "start_time": 1472393122365.661,
 "end_time": 1472393123665.163,
 "export_reason": 2,
 "metrics": {"application_name": "TLS.Facebook",
             "category_name": "SocialNetwork",
             "http_dns_server_name": "",
             "tls_client_server_name": "facebook.com",
             "tls_server_server_name": "*.facebook.com",
             "tls_server_organization": "Facebook, Inc.",
             "tls_version": "TLSv1.2",
             "tls_not_before": "2014-08-28 00:00:00+00:00",
             "tls_not_after": "2016-12-30 12:00:00+00:00"
             }
 }
  • Didn’t find a specific flow feature? add a plugin to the Streamer in few lines:

def my_awesome_plugin(packet_information, flow, direction):
 if packet_information.length > 666:
     return flow.metrics['count_pkts_gt_666'] + 1

streamer_awesome = Streamer(source='devil.pcap', user_metrics={'count_pkts_gt_666': my_awesome_plugin})
for export in streamer_awesome:
   print(export.metrics['count_pkts_gt_666']) # now you will see your created metric in generated flows
  • More example and details are provided on the official Documentation.

Getting Started

Prerequisites

apt-get install libpcap-dev

Installation

using pip

Binary installers for the latest released version are available:

pip3 install nfstream

from source

If you want to build nfstream on your local machine:

apt-get install autogen
git clone https://github.com/aouinizied/nfstream.git
# move to nfstream directory and run
python3 setup.py install

Contributing

Please read Contributing for details on our code of conduct, and the process for submitting pull requests to us.

Authors

Zied Aouini (aouinizied) created nfstream and these fine people have contributed.

License

This project is licensed under the GPLv3 License - see the License file for details

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

nfstream-1.2.0-cp38-cp38-manylinux1_x86_64.whl (690.5 kB view details)

Uploaded CPython 3.8

nfstream-1.2.0-cp37-cp37m-manylinux1_x86_64.whl (690.5 kB view details)

Uploaded CPython 3.7m

nfstream-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl (218.0 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

nfstream-1.2.0-cp37-cp37m-macosx_10_13_x86_64.whl (220.0 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

nfstream-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (690.5 kB view details)

Uploaded CPython 3.6m

nfstream-1.2.0-cp36-cp36m-macosx_10_13_x86_64.whl (218.5 kB view details)

Uploaded CPython 3.6m macOS 10.13+ x86-64

File details

Details for the file nfstream-1.2.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 690.5 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for nfstream-1.2.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 012c2af1056d06e60dcf2c1ebf54752b323bcc6ffe5b962f39a6334a988a2b8c
MD5 265961792a47c1dda4597062a1c4a92a
BLAKE2b-256 8b704d683ad1eab0ec0e07e09e4aa565b34f7ef3753cb09ac006250c8189580c

See more details on using hashes here.

File details

Details for the file nfstream-1.2.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 690.5 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.1

File hashes

Hashes for nfstream-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 694a4c23d84c1d09d22704529d253208f5cafc3f19331ba41fc6852c2bd4d64c
MD5 ecb6e62afe4f4503559e6f5e7daca3c1
BLAKE2b-256 7f65a216e51346d0939de5d3bacc2163ddf1a75c58ccaabb15d5f4a818de4417

See more details on using hashes here.

File details

Details for the file nfstream-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 218.0 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for nfstream-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 89c110796d68ef9103ff8b980fba0e950116c4f2384c314c3d4ff8ac3dd7fdb3
MD5 9c0b969521a9c1e16ee95c5bdb536cc4
BLAKE2b-256 58289868364dee38ae503a343aad5dd49f1b438e896765bcbcb71376146f44e9

See more details on using hashes here.

File details

Details for the file nfstream-1.2.0-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 220.0 kB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.0

File hashes

Hashes for nfstream-1.2.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e3a1c72d07154e18bc8f9ff9d189d43560618b0e22b5e9fd36286d8c44ac7ef5
MD5 5f1d5f10973edb04b7f4b7090ab36409
BLAKE2b-256 3d1dae0dadd091fc3b4ed839004f0a6df087a59ba6a4927cf1fd7bf35393d0bd

See more details on using hashes here.

File details

Details for the file nfstream-1.2.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 690.5 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.7

File hashes

Hashes for nfstream-1.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b6d167b720e50f2a7b5e91966c81ffabddb039ef4d82b339e59f1778e7921222
MD5 2fd70e4c77bee527ef9a4fbc964eb53e
BLAKE2b-256 985ffaffe058f4d1276951a208ae2a5593ee47e1dd171ffb7fb1deb978a5f4a1

See more details on using hashes here.

File details

Details for the file nfstream-1.2.0-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: nfstream-1.2.0-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 218.5 kB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.5

File hashes

Hashes for nfstream-1.2.0-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 81252f8fb306bed1b290c2abe75ddccf6508ebf1a5b8f5797a0aaa5b9121d5f2
MD5 2aa8c8692f3fa7aabaf62262a498eeeb
BLAKE2b-256 8efe48e19cf379b0778ab9a647abf1688f2df05ae9f7b174191d63aeb9c688a9

See more details on using hashes here.

Supported by

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