diff --git a/README.md b/README.md index c0423ec..1988231 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Happy Hacktoberfest! ## :confused: What the heck is a ferox anyway? -Ferox is short for Ferric Oxide. Ferric Oxide, simply put, is rust. The name rustbuster was taken, so I decided on a variation. ¯\_(ツ)_/¯ +Ferox is short for Ferric Oxide. Ferric Oxide, simply put, is rust. The name rustbuster was taken, so I decided on a variation. ¯\\_(ツ)_/¯ :open_book: Table of Contents ----------------- diff --git a/src/heuristics.rs b/src/heuristics.rs index d7120b9..7e8de36 100644 --- a/src/heuristics.rs +++ b/src/heuristics.rs @@ -1,6 +1,6 @@ use crate::config::{CONFIGURATION, PROGRESS_PRINTER}; -use crate::scanner::{make_request}; -use crate::utils::{ferox_print, get_url_path_length, status_colorizer, format_url}; +use crate::scanner::make_request; +use crate::utils::{ferox_print, format_url, get_url_path_length, status_colorizer}; use ansi_term::Color::{Cyan, Yellow}; use indicatif::ProgressBar; use reqwest::Response; @@ -186,19 +186,17 @@ async fn make_wildcard_request(target_url: &str, length: usize) -> Option10} {} redirects to => {:?}", - wildcard, - content_len, - response.url(), - next_loc - ), - &PROGRESS_PRINTER, - ); - } + } else if !CONFIGURATION.quiet { + ferox_print( + &format!( + "{} {:>10} {} redirects to => {:?}", + wildcard, + content_len, + response.url(), + next_loc + ), + &PROGRESS_PRINTER, + ); } } } diff --git a/src/logger.rs b/src/logger.rs index 8351538..16879c9 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -42,7 +42,7 @@ pub fn initialize(verbosity: u8) { let msg = format!( "{} {:10.03} {}", - style(format!("{}", level_name)).bg(level_color).black(), + style(level_name).bg(level_color).black(), style(t).dim(), style(record.args()).dim(), ); diff --git a/src/scanner.rs b/src/scanner.rs index 4e42460..e9d4b54 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -1,6 +1,8 @@ use crate::config::{CONFIGURATION, PROGRESS_BAR, PROGRESS_PRINTER}; use crate::heuristics::WildcardFilter; -use crate::utils::{ferox_print, get_current_depth, get_url_path_length, status_colorizer, format_url}; +use crate::utils::{ + ferox_print, format_url, get_current_depth, get_url_path_length, status_colorizer, +}; use crate::{heuristics, progress, FeroxResult}; use futures::future::{BoxFuture, FutureExt}; use futures::{stream, StreamExt}; @@ -14,8 +16,6 @@ use tokio::io::{self, AsyncWriteExt}; use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; use tokio::task::JoinHandle; - - /// Initiate request to the given `Url` using the pre-configured `Client` pub async fn make_request(client: &Client, url: &Url) -> FeroxResult { log::trace!("enter: make_request(CONFIGURATION.Client, {})", url); diff --git a/src/utils.rs b/src/utils.rs index 0742d04..b2fa1a8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,9 +1,9 @@ +use crate::FeroxResult; use ansi_term::Color::{Blue, Cyan, Green, Red, Yellow}; use console::{strip_ansi_codes, user_attended}; use indicatif::ProgressBar; use reqwest::Url; use std::convert::TryInto; -use crate::FeroxResult; /// Helper function that determines the current depth of a given url /// @@ -269,5 +269,4 @@ mod tests { reqwest::Url::parse("http://localhost/stuff/").unwrap() ); } - } diff --git a/tests/test_heuristics.rs b/tests/test_heuristics.rs index c3a9194..45adede 100644 --- a/tests/test_heuristics.rs +++ b/tests/test_heuristics.rs @@ -83,8 +83,8 @@ fn test_one_good_and_one_bad_target_scan_succeeds() -> Result<(), Box Result<(), Box teardown_tmp_directory(tmp_dir); - cmd.assert().success().stderr( + cmd.assert().success().stdout( predicate::str::contains("WLD") .and(predicate::str::contains("Got")) .and(predicate::str::contains("200")) diff --git a/tests/test_scanner.rs b/tests/test_scanner.rs index 45dc2b6..f1456ef 100644 --- a/tests/test_scanner.rs +++ b/tests/test_scanner.rs @@ -28,8 +28,8 @@ fn test_single_request_scan() -> Result<(), Box> { cmd.assert().success().stdout( predicate::str::contains("/LICENSE") - .and(predicate::str::contains("200 OK")) - .and(predicate::str::contains("[14 bytes]")), + .and(predicate::str::contains("200")) + .and(predicate::str::contains("14")), ); assert_eq!(mock.times_called(), 1);