#networking #capture #binary #traffic #analysis #net #io

bin+lib net-agent

net-agent is a binary crate which you can run to capture network traffic. Then all the captured traffic can be loaded to my.netstalker.io for further analysis

3 releases

0.1.2 Aug 20, 2024
0.1.1 Jul 9, 2024
0.1.0 Apr 10, 2024

#18 in #traffic

Download history 135/week @ 2024-08-20 1/week @ 2024-08-27 19/week @ 2024-09-10 8/week @ 2024-09-17 16/week @ 2024-09-24 1/week @ 2024-10-01

153 downloads per month

Apache-2.0

26KB
425 lines

Net Agent

Crates.io License

Net-agent is a stand-alone binary crate within the Net Stalker project that allows you to capture network traffic, which then can be uploaded to my.netstalker.io for further analysis.

Installation

To install net-agent, use Cargo:

cargo install net-agent

Requirements

Before running net-agent, make sure you have the necessary dependencies installed for your operating system:

Linux

  • Ubuntu/Debian:

    sudo apt-get install libpcap-dev
    
  • Fedora:

    sudo dnf install libpcap-devel
    
  • Arch:

    sudo pacman -S libpcap
    

macOS

  • libpcap should be installed on Mac OS X by default.

Windows

  1. Install Npcap.

  2. Download the Npcap SDK.

  3. Add the SDK's /Lib or /Lib/x64 folder to your LIB environment variable.

Usage

You can run net-agent with the following command-line options:

net-agent [OPTIONS]

The available options are:

  • -D, --device-name <DEVICE_NAME>: Specify the network device to capture traffic from.

  • -N, --number-packages <NUMBER_PACKAGES>: Specify the number of packages to capture.

  • -B, --buffer-size <BUFFER_SIZE>: Specify the buffer size for capturing packages.

  • -O, --output-directory <OUTPUT_DIRECTORY>: Specify the output directory for captured traffic (default: "output").

Note: The -C, --config-file option conflicts with all other options. If specified, the configuration will be loaded from the specified file.

Configuration

To use the configuration file, pass the -C, --config-file option with the path to the file.

  • template

    device_name = <DEVICE_NAME>
    number_packages = <NUMBER_PACKAGES>
    buffer_size = <BUFFER_SIZE>
    output_directory = <OUTPUT_DIRECTORY>
    
  • example

    device_name = "eth0"
    number_packages = 1000
    buffer_size = 2048
    output_directory = "captured_traffic"
    

Troubleshooting

On linux to run the application with sudo it usually needs to run

sudo cp ~/.cargo/bin/net-agent /usr/local/bin/

Contributing

All the contributions to net-agent are welcome! If you find any issues or have suggestions for improvements, please open an issue on the GitHub repository. If you want to contribute code to the project, please follow these steps:

  1. Clone the repository and create a new branch for your feature or bug fix.
  2. Make your changes and ensure that the code passes all tests and linting checks.
  3. Submit a pull request describing your changes and why they should be merged.

Please note that all contributions are subject to review and approval by the project maintainers.

License

net-agent is licensed under the Apache License, Version 2.0. See LICENSE for more information.

Dependencies

~20–34MB
~463K SLoC