From 6d1625a93b7b6093fbd7ddfc5669c36d54deeefb Mon Sep 17 00:00:00 2001 From: Giuliano Bellini <100347457+GyulyVGC@users.noreply.github.com> Date: Sun, 2 Oct 2022 22:19:50 +0200 Subject: [PATCH] Update README.md --- README.md | 103 +++++++++++++----------------------------------------- 1 file changed, 25 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 8698f4f5..8ca290c3 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,34 @@ -Sniffnet +

Sniffnet

-[![Build](https://github.com/GyulyVGC/sniffnet/actions/workflows/rust.yml/badge.svg)](https://github.com/GyulyVGC/sniffnet/actions/workflows/rust.yml) -[![Code Grade](https://api.codiga.io/project/34559/score/svg)](https://www.codiga.io/code-analysis/) -[![Version](https://img.shields.io/crates/v/sniffnet.svg)](https://crates.io/crates/sniffnet) -![License](https://img.shields.io/crates/l/sniffnet.svg) +
-Multithreaded application to analyze and filter network traffic. +

Application to analyze and filter your network traffic.

+

Multithreaded, cross-platform, reliable.

-Several command line options are available to select the network adapter to inspect, to set a desired reports update frequency and to specify filters on the observed traffic. +

+ +  + +

+ -Sniffnet generates a graphical representation of the filtered traffic's intensity and a detailed textual report about the observed packets. - - - - -

- - +

+ +  +


-
+

+ +

- Table of contents +

+ + +

-- [Install](#install) - -- [Command line options](#command-line-options) - -- [User interactions during application execution](#user-interactions-during-application-execution) - -- [Graphical report](#graphical-report) - -- [Textual reports](#textual-reports) - -- [Supported application layer protocols](#supported-application-layer-protocols) - -- [Implementation details](#implementation-details) - -- [Error conditions](#error-conditions) - + Wrong command line options specification - + Pcap permission denied error - + Textual report contains just the header - -- [Contribute](#contribute) - -
- -
## Install @@ -56,9 +36,10 @@ The application binary can be installed with ```cargo install sniffnet``` The application can then be run using ```sniffnet [OPTIONS]``` +
- Build on Windows + Build on Windows  In order to build and run Sniffnet on Windows systems you need to: @@ -73,7 +54,7 @@ The application can then be run using ```sniffnet [OPTIONS]```
- Build on Linux + Build on Linux  In order to build and run Sniffnet on Linux systems, install the libraries and header files for the libpcap library. For example: @@ -88,7 +69,7 @@ The application can then be run using ```sniffnet [OPTIONS]```
- Build on MacOS + Build on MacOS  MacOS natively has all the dependencies you need to build and run Sniffnet! @@ -132,18 +113,6 @@ specifies the name of the output folder to contain textual and graphical reports - **-t, --trans**: filters packets on the basis of the provided transport layer protocol (TCP or UDP). - -## User interactions during application execution - -The user can interact with the sniffing process through the terminal window. - -- **Pause**: to temporarily pause the sniffing process, the user can type a 'p' character in the terminal window. - - -- **Resume**: to later resume the sniffing process, the user can type a 'r' character in the terminal window. - - -- **Stop**: to stop the application execution, the user can type a 's' character in the terminal window. ## Graphical report @@ -241,28 +210,6 @@ please note that application level protocols are just inferred from the transpor
-## Implementation details - - -
- - See details - -The application consists in three different execution flows. - -The main thread waits for eventual [user actions](#user-interactions-during-application-execution) (by putting the terminal in raw mode through the ```crossterm::screen::raw::into_raw_mode()``` function and creating a ```crossterm::SyncReader``` which allows to read the input synchronously); in doing so it signals to the secondary threads when to pause or resume their work. -The signaling is made possible by setting an application status, shared with the secondary threads and associated to a mutex and a condition variable. - -The ```main()``` function, entry point of program execution, generates two secondary threads: one is in charge of waiting for network packets and parsing them, while the other is in charge of updating the textual and graphical reports every ```interval``` seconds (with ```interval``` defined by the user through the ```-i``` option; if omitted it's equal to 5 seconds). - -The thread in charge of parsing packets also insert them into a shared map, where the key part is represented by an ```AddressPortPair``` struct and the value part is represented by a ```InfoAddressPortPair``` struct. -Before parsing each packet it checks the application status: if it is ```Status::Pause``` it waits, otherwise it proceeds parsing the packet. -This thread waits for packets without consuming CPU resources through the ```pcap::Capture::next_packet()``` method. - -The thread in charge of updating the textual and graphical reports sleeps for ```interval``` seconds and re-writes the reports with updated traffic statistics. - - -
## Error conditions