diff --git a/README.md b/README.md
index 4a97f99..148291a 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,9 @@
-# speedboat
+
+
+
-lightweight web service aggregator, offering performance/reliability that httpX lacks for protracted scans
\ No newline at end of file
+
+ speedboat
+
+ lightweight web service aggregator, offering performance/reliability that httpX lacks for protracted scans
+
\ No newline at end of file
diff --git a/src/common/conf.rs b/src/common/conf.rs
index f07cff5..b2d366c 100644
--- a/src/common/conf.rs
+++ b/src/common/conf.rs
@@ -10,7 +10,7 @@ pub struct Params {
#[derive(Parser, Default)]
#[clap(
author = "tommy touchdown",
- about = "speedboat - lightweight web content aggregator",
+ about = "speedboat - lightweight web service aggregator",
version = VERSION
)]
pub struct Config {
diff --git a/src/common/console.rs b/src/common/console.rs
index 49191f4..42bbfa0 100644
--- a/src/common/console.rs
+++ b/src/common/console.rs
@@ -18,18 +18,34 @@ pub fn fmtcode(code: u16) -> ColoredString {
}
}
-pub fn parsehit(sc: u16, url: String, title: &str) -> String {
+pub fn parsetitle(s: String) -> String {
+ let mut out = String::with_capacity(s.len());
+ s.split_whitespace().for_each(|w| {
+ if !out.is_empty() {
+ out.push(' ');
+ }
+ out.push_str(w);
+ });
+ out
+}
+
+pub fn parsehit(sc: u16, url: String, title: String) -> String {
format!(
"{} {} {} {}{}{}",
fmtcode(sc),
"|".black().bold(),
url.white().underline(),
- "[".black(),
- title.trim_matches(['\n', '\t', '\r']).bright_cyan().bold(),
- "]".black()
+ "[".black().bold(),
+ parsetitle(title).bright_cyan().bold(),
+ "]".black().bold()
)
}
pub fn banner() {
- eprintln!("{}{} {}", "speed".bright_cyan().bold(), "boat".bright_magenta().bold(), VERSION.black())
-}
\ No newline at end of file
+ eprintln!(
+ "{}{} {}",
+ "speed".bright_cyan().bold(),
+ "boat".bright_magenta().bold(),
+ VERSION.black()
+ );
+}
diff --git a/src/common/exec.rs b/src/common/exec.rs
index ad2b7a6..63a3953 100644
--- a/src/common/exec.rs
+++ b/src/common/exec.rs
@@ -1,5 +1,8 @@
use futures::{stream, StreamExt};
-use std::{fs::File, io::{BufReader, BufRead}};
+use std::{
+ fs::File,
+ io::{BufRead, BufReader},
+};
use super::{
conf::{Config, Params},
@@ -11,19 +14,24 @@ pub async fn takeoff(args: Config, params: Params) {
let c = mkclient(args.follow).unwrap_or_else(|_| fatal("error instantiating http client"));
let file = File::open(args.list)
- .unwrap_or_else(|e| fatal(format!("unable to read file: {e}").as_str()));
+ .unwrap_or_else(|e| fatal(format!("unable to read file: {e}").as_str()));
-// Create a buffered reader.
-let buf = BufReader::new(file);
+ // Create a buffered reader.
+ let buf = BufReader::new(file);
stream::iter(buf.lines())
.for_each_concurrent(args.threads, |line| {
- // call request function
-
let wc = c.clone();
let scodes = params.statcodes.clone();
async move {
- let _ = query(wc, line.unwrap_or_else(|_| fatal("error attempting buffered read")).trim(), scodes, params.exclude).await;
+ let _ = query(
+ wc,
+ line.unwrap_or_else(|_| fatal("error attempting buffered read"))
+ .trim(),
+ scodes,
+ params.exclude,
+ )
+ .await;
}
})
.await;
diff --git a/src/common/net.rs b/src/common/net.rs
index 959b91b..d8ce68d 100644
--- a/src/common/net.rs
+++ b/src/common/net.rs
@@ -42,20 +42,15 @@ pub async fn query(
let url: String = response.url().to_string();
let body = response.text().await?;
- // Parse the HTML document
let document = Document::from(body.as_str());
- // Use select to find the tag
let title = document
.find(Name("title"))
.next()
.map(|n| n.text())
.unwrap_or_else(|| "".to_string());
- println!(
- "{}",
- parsehit(sc, url, title.trim_matches(['\n', '\t', '\r']))
- );
+ println!("{}", parsehit(sc, url, title));
Ok(())
}
diff --git a/src/main.rs b/src/main.rs
index 55b6a8c..0f3d66c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,4 +7,4 @@ async fn main() {
common::console::banner();
common::exec::takeoff(args, scanparams).await;
-}
+}
\ No newline at end of file