From b007e43544e59aa88ce3ce65526705179a194439 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Thu, 15 Feb 2024 16:17:13 +0100 Subject: [PATCH] fix: renamed proto field to transport and setting protocol from banner grabber --- src/plugins/tcp_ports/grabbers/http.rs | 10 ++++++++++ src/plugins/tcp_ports/mod.rs | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/tcp_ports/grabbers/http.rs b/src/plugins/tcp_ports/grabbers/http.rs index e39f83d..b7b012a 100644 --- a/src/plugins/tcp_ports/grabbers/http.rs +++ b/src/plugins/tcp_ports/grabbers/http.rs @@ -46,6 +46,16 @@ pub(crate) async fn http_grabber( timeout: Duration, ) -> Banner { let mut banner = Banner::default(); + + banner.insert( + "protocol".to_owned(), + if ssl { + "https".to_owned() + } else { + "http".to_owned() + }, + ); + let url = format!( "{}://{}:{}/", if ssl { "https" } else { "http" }, diff --git a/src/plugins/tcp_ports/mod.rs b/src/plugins/tcp_ports/mod.rs index 2de3595..5f01ff9 100644 --- a/src/plugins/tcp_ports/mod.rs +++ b/src/plugins/tcp_ports/mod.rs @@ -77,7 +77,7 @@ impl Plugin for TcpPortScanner { crate::utils::net::async_tcp_stream(&address, timeout, false).await { let mut data = vec![ - ("proto".to_owned(), "tcp".to_owned()), + ("transport".to_owned(), "tcp".to_owned()), ("port".to_owned(), creds.username.to_owned()), ("time".to_owned(), format!("{:?}", start.elapsed())), ]; @@ -93,7 +93,11 @@ impl Plugin for TcpPortScanner { .await; for (key, val) in banner { - data.push((format!("banner.{}", key), val)); + if key == "proto" || key == "protocol" { + data.push(("protocol".to_owned(), val)); + } else { + data.push((format!("banner.{}", key), val)); + } } }