Skip to content

Commit

Permalink
que
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaylor89 committed Aug 24, 2024
1 parent c7cf9a9 commit b2a0836
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
27 changes: 20 additions & 7 deletions src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
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<String, TargetInfo>,
timeout: u64,
proxy: Option<&String>,
print_all: bool,
print_found: bool,
dump_response: bool,
browse: bool,
options: CheckOptions,
) -> color_eyre::Result<Vec<QueryResult>> {
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"));
Expand All @@ -34,7 +47,7 @@ pub async fn check_username(
site,
info,
timeout,
proxy.cloned(),
proxy.clone(),
)?;
}

Expand Down
18 changes: 10 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b2a0836

Please sign in to comment.