From 4f974ea2cb52886317396a09cc5cccfa5f7bd424 Mon Sep 17 00:00:00 2001 From: Johannes Naylor Date: Sat, 24 Aug 2024 17:51:01 +0200 Subject: [PATCH] mess with references --- src/checker.rs | 10 +++++----- src/main.rs | 23 ++++++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index 4f5ee5d..624f7e7 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -21,7 +21,7 @@ pub struct CheckOptions { pub async fn check_username( username: &str, site_data: HashMap, - options: CheckOptions, + options: &CheckOptions, ) -> color_eyre::Result> { let CheckOptions { timeout, @@ -46,7 +46,7 @@ pub async fn check_username( username.to_owned(), site, info, - timeout, + *timeout, proxy.clone(), )?; } @@ -124,7 +124,7 @@ pub async fn check_username( } }; - if dump_response { + if *dump_response { println!("+++++++++++++++++++++"); println!("TARGET NAME : {site}"); println!("USERNAME : {username}"); @@ -146,7 +146,7 @@ pub async fn check_username( println!("+++++++++++++++++++++"); } - if browse && status == QueryStatus::Claimed { + if *browse && status == QueryStatus::Claimed { open::that(&url).inspect_err(|e| eprintln!("Failed to open browser: {}", e))?; } @@ -163,7 +163,7 @@ pub async fn check_username( } }; - if print_all || (print_found && query_result.status == QueryStatus::Claimed) { + if *print_all || (*print_found && query_result.status == QueryStatus::Claimed) { print_result(&query_result); } results.push(query_result); diff --git a/src/main.rs b/src/main.rs index 5a37ccf..1ec125a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,20 +121,17 @@ async fn main() -> Result<()> { let username_variants = create_username_variants(&cli.usernames); + let check_options = 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, + }; + for username in username_variants { - let results = check_username( - &username, - filtered_targets.clone(), - 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?; + let results = check_username(&username, filtered_targets.clone(), &check_options).await?; save_results( &username, results,