-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(entry): run subcommands from engine; cleaned main
- Loading branch information
Showing
2 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::{ | ||
commands::{ | ||
fuzz::fuzzer::fuzz_url, rdns::rev_dns::reverse_dns_lookup, | ||
status::statuscode::handle_status_command, takeover::sub_takeover::subdomain_takeover, | ||
urldencode::dencode_urls, | ||
}, | ||
interface::args::{Cli, CommandChoice}, | ||
log::abort, | ||
}; | ||
use clap::Parser; | ||
|
||
pub async fn start() { | ||
let cli = Cli::parse(); | ||
|
||
let result = match cli.command { | ||
CommandChoice::Status(status_args) => handle_status_command(status_args).await, | ||
CommandChoice::Fuzzer(fuzz_args) => fuzz_url(fuzz_args).await, | ||
CommandChoice::Rdns(rdns_args) => reverse_dns_lookup(rdns_args).await, | ||
CommandChoice::Takeover(takeover_args) => subdomain_takeover(takeover_args).await, | ||
CommandChoice::Dencode(dencode_args) => dencode_urls(dencode_args).await, | ||
}; | ||
|
||
if let Err(err) = result { | ||
abort(&format!("{}", err)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,10 @@ | ||
use { | ||
crate::{ | ||
commands::{ | ||
fuzz::fuzzer::fuzz_url, rdns::rev_dns::reverse_dns_lookup, | ||
status::statuscode::handle_status_command, takeover::sub_takeover::subdomain_takeover, | ||
urldencode::dencode_urls, | ||
}, | ||
interface::args::{Cli, CommandChoice}, | ||
}, | ||
anyhow::Result, | ||
clap::Parser, | ||
}; | ||
|
||
mod commands; | ||
mod engine; | ||
mod interface; | ||
mod log; | ||
|
||
// asynchronous entry point where the magic happens :dizzy: | ||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let cli = Cli::parse(); | ||
|
||
let result = match cli.command { | ||
CommandChoice::Status(status_args) => handle_status_command(status_args).await, | ||
CommandChoice::Fuzzer(fuzz_args) => fuzz_url(fuzz_args).await, | ||
CommandChoice::Rdns(rdns_args) => reverse_dns_lookup(rdns_args).await, | ||
CommandChoice::Takeover(takeover_args) => subdomain_takeover(takeover_args).await, | ||
CommandChoice::Dencode(dencode_args) => dencode_urls(dencode_args).await, | ||
}; | ||
|
||
if let Err(err) = result { | ||
eprintln!("Error: {}", err); | ||
std::process::exit(1); | ||
} | ||
Ok(()) | ||
async fn main() { | ||
engine::start().await; | ||
} |