mirror of
https://github.com/epi052/feroxbuster
synced 2024-07-08 19:45:45 +00:00
updated default status codes to all; adjusted banner entry
This commit is contained in:
parent
0d64d28fe6
commit
ac7f59cd3f
|
@ -3,7 +3,7 @@ use crate::{
|
|||
config::Configuration,
|
||||
event_handlers::Handles,
|
||||
utils::{logged_request, status_colorizer},
|
||||
DEFAULT_IGNORED_EXTENSIONS, DEFAULT_METHOD, VERSION,
|
||||
DEFAULT_IGNORED_EXTENSIONS, DEFAULT_METHOD, DEFAULT_STATUS_CODES, VERSION,
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use console::{style, Emoji};
|
||||
|
@ -204,12 +204,25 @@ impl Banner {
|
|||
));
|
||||
}
|
||||
|
||||
let mut codes = vec![];
|
||||
for code in &config.status_codes {
|
||||
codes.push(status_colorizer(&code.to_string()))
|
||||
}
|
||||
let status_codes =
|
||||
BannerEntry::new("👌", "Status Codes", &format!("[{}]", codes.join(", ")));
|
||||
// the +2 is for the 2 experimental status codes we add to the default list manually
|
||||
let status_codes = if config.status_codes.len() == DEFAULT_STATUS_CODES.len() + 2 {
|
||||
let all_str = format!(
|
||||
"{} {} {}{}",
|
||||
style("All").blue(),
|
||||
style("Status").green(),
|
||||
style("Codes").yellow(),
|
||||
style("!").red()
|
||||
);
|
||||
BannerEntry::new("👌", "Status Codes", &all_str)
|
||||
} else {
|
||||
let mut codes = vec![];
|
||||
|
||||
for code in &config.status_codes {
|
||||
codes.push(status_colorizer(&code.to_string()))
|
||||
}
|
||||
|
||||
BannerEntry::new("👌", "Status Codes", &format!("[{}]", codes.join(", ")))
|
||||
};
|
||||
|
||||
for code in &config.filter_status {
|
||||
code_filters.push(status_colorizer(&code.to_string()))
|
||||
|
|
|
@ -46,11 +46,14 @@ pub(super) fn threads() -> usize {
|
|||
|
||||
/// default status codes
|
||||
pub(super) fn status_codes() -> Vec<u16> {
|
||||
// DEFAULT_STATUS_CODES
|
||||
// .iter()
|
||||
// .map(|code| code.as_u16())
|
||||
// .collect()
|
||||
Vec::new()
|
||||
DEFAULT_STATUS_CODES
|
||||
.iter()
|
||||
.map(|code| code.as_u16())
|
||||
// add experimental codes not found in reqwest
|
||||
// - 103 - EARLY_HINTS
|
||||
// - 425 - TOO_EARLY
|
||||
.chain([103, 425])
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// default HTTP Method
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use super::*;
|
||||
use fuzzyhash::FuzzyHash;
|
||||
use gaoya::minhash::{MinHash, MinHasher, MinHasher16};
|
||||
use gaoya::minhash::{MinHasher, MinHasher16};
|
||||
use gaoya::text::whitespace_split;
|
||||
|
||||
/// enum wrapper for two distinct hashing signature types
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub(crate) enum HashValueType {
|
||||
pub enum HashValueType {
|
||||
/// String value for FuzzyHash
|
||||
String(String),
|
||||
|
||||
|
|
|
@ -45,11 +45,13 @@ pub(crate) async fn create_similarity_filter(
|
|||
|
||||
// hash the response body and store the resulting hash in the filter object
|
||||
let hash = if fr.content_length() <= MIN_SSDEEP_SIZE {
|
||||
log::debug!("response too small for ssdeep, using minhash for comparison");
|
||||
// response too small for ssdeep
|
||||
let hasher = MinHasher16::new(256);
|
||||
HashValueType::Vec(hasher.create_signature(whitespace_split(fr.text())))
|
||||
} else {
|
||||
// size over ssdeep's minimum value
|
||||
log::debug!("response large enough to use ssdeep for comparison");
|
||||
HashValueType::String(FuzzyHash::new(fr.text()).to_string())
|
||||
};
|
||||
|
||||
|
|
70
src/lib.rs
70
src/lib.rs
|
@ -90,29 +90,73 @@ pub(crate) const SLEEP_DURATION: u64 = 500;
|
|||
/// The percentage of requests as errors it takes to be deemed too high
|
||||
pub const HIGH_ERROR_RATIO: f64 = 0.90;
|
||||
|
||||
/// Default list of status codes to report
|
||||
///
|
||||
/// * 200 Ok
|
||||
/// * 204 No Content
|
||||
/// * 301 Moved Permanently
|
||||
/// * 302 Found
|
||||
/// * 307 Temporary Redirect
|
||||
/// * 308 Permanent Redirect
|
||||
/// * 401 Unauthorized
|
||||
/// * 403 Forbidden
|
||||
/// * 405 Method Not Allowed
|
||||
/// * 500 Internal Server Error
|
||||
pub const DEFAULT_STATUS_CODES: [StatusCode; 10] = [
|
||||
/// Default list of status codes to report (all of them)
|
||||
pub const DEFAULT_STATUS_CODES: [StatusCode; 60] = [
|
||||
// all 1XX response codes
|
||||
StatusCode::CONTINUE,
|
||||
StatusCode::SWITCHING_PROTOCOLS,
|
||||
StatusCode::PROCESSING,
|
||||
// all 2XX response codes
|
||||
StatusCode::OK,
|
||||
StatusCode::CREATED,
|
||||
StatusCode::ACCEPTED,
|
||||
StatusCode::NON_AUTHORITATIVE_INFORMATION,
|
||||
StatusCode::NO_CONTENT,
|
||||
StatusCode::RESET_CONTENT,
|
||||
StatusCode::PARTIAL_CONTENT,
|
||||
StatusCode::MULTI_STATUS,
|
||||
StatusCode::ALREADY_REPORTED,
|
||||
StatusCode::IM_USED,
|
||||
// all 3XX response codes
|
||||
StatusCode::MULTIPLE_CHOICES,
|
||||
StatusCode::MOVED_PERMANENTLY,
|
||||
StatusCode::FOUND,
|
||||
StatusCode::SEE_OTHER,
|
||||
StatusCode::NOT_MODIFIED,
|
||||
StatusCode::USE_PROXY,
|
||||
StatusCode::TEMPORARY_REDIRECT,
|
||||
StatusCode::PERMANENT_REDIRECT,
|
||||
// all 4XX response codes
|
||||
StatusCode::BAD_REQUEST,
|
||||
StatusCode::UNAUTHORIZED,
|
||||
StatusCode::PAYMENT_REQUIRED,
|
||||
StatusCode::FORBIDDEN,
|
||||
StatusCode::NOT_FOUND,
|
||||
StatusCode::METHOD_NOT_ALLOWED,
|
||||
StatusCode::NOT_ACCEPTABLE,
|
||||
StatusCode::PROXY_AUTHENTICATION_REQUIRED,
|
||||
StatusCode::REQUEST_TIMEOUT,
|
||||
StatusCode::CONFLICT,
|
||||
StatusCode::GONE,
|
||||
StatusCode::LENGTH_REQUIRED,
|
||||
StatusCode::PRECONDITION_FAILED,
|
||||
StatusCode::PAYLOAD_TOO_LARGE,
|
||||
StatusCode::URI_TOO_LONG,
|
||||
StatusCode::UNSUPPORTED_MEDIA_TYPE,
|
||||
StatusCode::RANGE_NOT_SATISFIABLE,
|
||||
StatusCode::EXPECTATION_FAILED,
|
||||
StatusCode::IM_A_TEAPOT,
|
||||
StatusCode::MISDIRECTED_REQUEST,
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
StatusCode::LOCKED,
|
||||
StatusCode::FAILED_DEPENDENCY,
|
||||
StatusCode::UPGRADE_REQUIRED,
|
||||
StatusCode::PRECONDITION_REQUIRED,
|
||||
StatusCode::TOO_MANY_REQUESTS,
|
||||
StatusCode::REQUEST_HEADER_FIELDS_TOO_LARGE,
|
||||
StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS,
|
||||
// all 5XX response codes
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
StatusCode::NOT_IMPLEMENTED,
|
||||
StatusCode::BAD_GATEWAY,
|
||||
StatusCode::SERVICE_UNAVAILABLE,
|
||||
StatusCode::GATEWAY_TIMEOUT,
|
||||
StatusCode::HTTP_VERSION_NOT_SUPPORTED,
|
||||
StatusCode::VARIANT_ALSO_NEGOTIATES,
|
||||
StatusCode::INSUFFICIENT_STORAGE,
|
||||
StatusCode::LOOP_DETECTED,
|
||||
StatusCode::NOT_EXTENDED,
|
||||
StatusCode::NETWORK_AUTHENTICATION_REQUIRED,
|
||||
];
|
||||
|
||||
/// Default method for requests
|
||||
|
|
Loading…
Reference in New Issue
Block a user