From b2a0836bbcc8b0dcee4deb446be352fb82fe31dc Mon Sep 17 00:00:00 2001 From: Johannes Naylor Date: Sat, 24 Aug 2024 17:48:46 +0200 Subject: [PATCH] que --- src/checker.rs | 27 ++++++++++++++++++++------- src/main.rs | 18 ++++++++++-------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index c77701b..4f5ee5d 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -9,16 +9,29 @@ use color_eyre::eyre; use std::collections::HashMap; use tokio::sync::mpsc::channel; +pub struct CheckOptions { + pub timeout: u64, + pub proxy: Option, + pub print_all: bool, + pub print_found: bool, + pub dump_response: bool, + pub browse: bool, +} + pub async fn check_username( username: &str, site_data: HashMap, - timeout: u64, - proxy: Option<&String>, - print_all: bool, - print_found: bool, - dump_response: bool, - browse: bool, + options: CheckOptions, ) -> color_eyre::Result> { + let CheckOptions { + timeout, + proxy, + print_all, + print_found, + dump_response, + browse, + } = options; + let num_of_sites = site_data.keys().len(); if num_of_sites == 0 { return Err(eyre::eyre!("No sites to check")); @@ -34,7 +47,7 @@ pub async fn check_username( site, info, timeout, - proxy.cloned(), + proxy.clone(), )?; } diff --git a/src/main.rs b/src/main.rs index 64e1c92..5a37ccf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use clap::Parser; use color_eyre::Result; -use sherlock:: - checker::check_username, +use sherlock::{ + checker::{check_username, CheckOptions}, get_data::{get_default_data, get_json_data}, output::save_results, sherlock_target_manifest::SherlockTargetManifest, @@ -125,12 +125,14 @@ async fn main() -> Result<()> { let results = check_username( &username, filtered_targets.clone(), - cli.timeout, - cli.proxy.as_ref(), - cli.print_all, - cli.print_found, - cli.dump_response, - cli.browse, + CheckOptions { + timeout: cli.timeout, + proxy: cli.proxy.clone(), + print_all: cli.print_all, + print_found: cli.print_found, + dump_response: cli.dump_response, + browse: cli.browse, + }, ) .await?; save_results(