mirror of
https://github.com/epi052/feroxbuster.git
synced 2026-06-08 02:31:16 -03:00
clippy passes; ran fmt; fixed tests
This commit is contained in:
@@ -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
|
||||
-----------------
|
||||
|
||||
@@ -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) -> Option<Respon
|
||||
&PROGRESS_PRINTER,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if !CONFIGURATION.quiet {
|
||||
ferox_print(
|
||||
&format!(
|
||||
"{} {:>10} {} 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
|
||||
@@ -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<Response> {
|
||||
log::trace!("enter: make_request(CONFIGURATION.Client, {})", url);
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ fn test_one_good_and_one_bad_target_scan_succeeds() -> Result<(), Box<dyn std::e
|
||||
.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);
|
||||
|
||||
@@ -115,7 +115,7 @@ fn test_static_wildcard_request_found() -> Result<(), Box<dyn std::error::Error>
|
||||
|
||||
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"))
|
||||
|
||||
@@ -28,8 +28,8 @@ fn test_single_request_scan() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user