diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index 2ef2a9f..ea4904a 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.18.3] - 2024-09-10 + +### Fixed + +- Fix parsing of `tshark --version` output. + ## [0.18.2] - 2024-05-22 ### Fixed diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 017b343..90c6e05 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -521,7 +521,7 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "ja4" -version = "0.18.2" +version = "0.18.3" dependencies = [ "clap", "color-eyre", @@ -548,7 +548,7 @@ dependencies = [ [[package]] name = "ja4x" -version = "0.18.2" +version = "0.18.3" dependencies = [ "clap", "color-eyre", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 73adea9..0279ff5 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -3,7 +3,7 @@ members = ["ja4", "ja4x"] resolver = "2" [workspace.package] -version = "0.18.2" +version = "0.18.3" license = "LicenseRef-FoxIO-Proprietary" repository = "https://github.com/FoxIO-LLC/ja4" diff --git a/rust/ja4/src/lib.rs b/rust/ja4/src/lib.rs index cd32361..1d779e3 100644 --- a/rust/ja4/src/lib.rs +++ b/rust/ja4/src/lib.rs @@ -195,8 +195,9 @@ fn parse_tshark_version(tshark_version_output: &str) -> Option<&str> { // "TShark (Wireshark) 4.0.8 (v4.0.8-0-g81696bb74857).\n" let start = tshark_version_output.find(") ").map(|i| i + 2)?; let version_start = &tshark_version_output[start..]; - let end = version_start.find(' ')?; - Some(&version_start[..end]) + let end = version_start.find(char::is_whitespace)?; + let ver = &version_start[..end]; + Some(ver.strip_suffix('.').unwrap_or(ver)) } #[test] @@ -209,6 +210,12 @@ fn test_parse_tshark_version() { parse_tshark_version("TShark (Wireshark) 3.6.2 (Git v3.6.2 packaged as 3.6.2-2)"), Some("3.6.2") ); + assert_eq!( + parse_tshark_version("TShark (Wireshark) 4.4.0.\n\nCopyright 1998-2024"), + Some("4.4.0") + ); + // Abrupt end of the string. + assert!(parse_tshark_version("TShark (Wireshark) 4.4.0.").is_none()); assert!(parse_tshark_version("What the TShark?!").is_none()); }