Skip to content

Commit

Permalink
fix: renamed proto field to transport and setting protocol from banne…
Browse files Browse the repository at this point in the history
…r grabber
  • Loading branch information
evilsocket committed Feb 15, 2024
1 parent f06e3f9 commit b007e43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/plugins/tcp_ports/grabbers/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/tcp_ports/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
];
Expand All @@ -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));
}
}
}

Expand Down

0 comments on commit b007e43

Please sign in to comment.