/netmon-proc

Network traffic monitoring for processes

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Network Monitoring for Processes

netmon-proc is a network monitoring CLI tool designed to monitor network traffic and provide detailed metrics for specified processes. It leverages Scapy for packet sniffing and offers multiple formatting options for the output.

Table of Contents

Features

  • Real-time network traffic monitoring for specific processes.
  • Metrics aggregation and reporting.
  • Support for different output formats, including JSON and tabular formats.
  • Threaded implementation for efficient performance.
  • Customizable filtering using BPF (Berkeley Packet Filter) syntax.

Installation

You can install netmon-proc from PyPI or by pulling the Docker image.

From PyPI

  1. Install the package using pip:
pip install netmon-proc

From Docker

  1. Pull the Docker image:
docker pull 0xzer0x/netmon-proc
  1. Run the container:
docker container run -it --pid=host --network=host --cap-add=CAP_NET_RAW --cap-add=CAP_SYS_PTRACE --security-opt apparmor=unconfined 0xzer0x/netmon-proc

From Source

  1. Clone the repository:
git clone https://github.com/0xzer0x/netmon-proc.git
cd netmon-proc
  1. Install main dependencies:
poetry install --without=dev
  1. Build the package:
poetry build
  1. Install the package:
pip install dist/netmon_proc-0.x.x-py3-none-any.whl

Usage

Command Line Interface

netmon-proc provides a CLI for starting the network monitoring tool. Below are some usage examples.

netmon-proc --help

Example Command

To start monitoring network traffic for a specific process with a BPF filter and output the results in a table format:

netmon-proc --filter "tcp port 443" --format table --metrics rx_bytes firefox

License

This project is licensed under the GPL v3 License. See the LICENSE file for more details.