mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-10-21 06:31:14 +00:00
v0.3.2
This commit is contained in:
parent
dc86816a05
commit
4f03473c8c
2 changed files with 12 additions and 5 deletions
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "sniffnet"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
edition = "2021"
|
||||
description = "Application to sniff and filter network traffic. Generates a human-readable report of the observed packets."
|
||||
repository = "https://github.com/Crirock/pdsproject"
|
||||
readme = "README.md"
|
||||
keywords = ["cli", "network", "packet", "sniffer", "parser"]
|
||||
keywords = ["filter", "network", "packet", "sniffer", "parser"]
|
||||
categories = ["command-line-utilities", "concurrency", "network-programming"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
|
|
|
|||
|
|
@ -379,9 +379,16 @@ fn get_app_layer_string(app_layer: AppProtocol) -> String {
|
|||
///
|
||||
/// * `filtered` - Number of filtered packets
|
||||
fn get_filtered_packets_string(sniffed: u128, filtered: u128) -> String {
|
||||
if sniffed != 0 {
|
||||
format!("<><>\t\t\tConsidered packets: {} ({:.1}%)\n",
|
||||
filtered.separate_with_underscores(), 100.0*filtered as f32/sniffed as f32)
|
||||
if sniffed != 0 && filtered != 0 {
|
||||
let percentage_string =
|
||||
if format!("{:.2}", 100.0*filtered as f32/sniffed as f32).eq("0.00") {
|
||||
"(<0.01%)".to_string()
|
||||
}
|
||||
else {
|
||||
format!("({:.2}%)", 100.0*filtered as f32/sniffed as f32)
|
||||
};
|
||||
format!("<><>\t\t\tConsidered packets: {} {}\n",
|
||||
filtered.separate_with_underscores(), percentage_string)
|
||||
}
|
||||
else {
|
||||
format!("<><>\t\t\tConsidered packets: {}\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue