This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de34250
commit 7d4f962
Showing
3 changed files
with
134 additions
and
124 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,30 @@ | ||
//discover.rs | ||
use std::fs::File; | ||
use std::io::{BufRead, BufReader}; | ||
use reqwest; | ||
use colored::*; | ||
|
||
pub async fn discover(url: String, wordlist: String) -> Result<(), Box<dyn std::error::Error + Send + Sync>> { | ||
let file = File::open(wordlist).expect("Failed to open the file."); | ||
|
||
// Create a BufReader to read the file efficiently | ||
let reader = BufReader::new(file); | ||
|
||
// Iterate over each line in the wordlist | ||
for line in reader.lines() { | ||
if let Ok(word) = line { | ||
let target = url.clone().to_string() + &word.to_string(); | ||
let response = reqwest::get(target.clone()).await?; | ||
let status = response.status().to_string(); | ||
//let resp = response.json::<HashMap<String, String>>().await?; | ||
|
||
let code:Option<&str> = status.split_whitespace().nth(0); | ||
let result = match code { | ||
Some(code) => code.to_string(), | ||
None => String::from("Unknown"), | ||
}; | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
} | ||
Ok(()) | ||
} |
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,99 @@ | ||
//discover_filter.rs | ||
use std::env; | ||
use std::fs::File; | ||
use std::io::{BufRead, BufReader}; | ||
use reqwest; | ||
use colored::*; | ||
|
||
pub async fn discover_filter(url: String, wordlist: String, filteree: String, type_fiter: String) -> Result<(), Box<dyn std::error::Error + Send + Sync>> { | ||
let file = File::open(wordlist).expect("Failed to open the file."); | ||
|
||
// Create a BufReader to read the file efficiently | ||
let reader = BufReader::new(file); | ||
|
||
// Iterate over each line in the wordlist | ||
for line in reader.lines() { | ||
if let Ok(word) = line { | ||
match type_fiter.as_str() { | ||
"--bycode" => { | ||
let target = url.clone().to_string() + &*word.to_string(); | ||
let response = reqwest::get(target.clone()).await?; | ||
let status = response.status().to_string(); | ||
//let resp = response.json::<HashMap<String, String>>().await?; | ||
|
||
let code:Option<&str> = status.split_whitespace().nth(0); | ||
let result = match code { | ||
Some(code) => code.to_string(), | ||
None => String::from("Unknown"), | ||
}; | ||
match filteree.as_str() { | ||
"200" => { | ||
if response.status().is_success() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
"404" | "401" | "402" | "403" => { | ||
if response.status().is_client_error() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
|
||
"301" | "307" | "302" => { | ||
if response.status().is_redirection() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
|
||
"500" | "502" => { | ||
if response.status().is_server_error() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
_ => println!("Unknown Status code") | ||
} | ||
}, | ||
|
||
"--bytype" => { | ||
let target = url.clone().to_string() + &*word.to_string(); | ||
let response = reqwest::get(target.clone()).await?; | ||
let status = response.status().to_string(); | ||
//let resp = response.json::<HashMap<String, String>>().await?; | ||
|
||
let code:Option<&str> = status.split_whitespace().nth(0); | ||
let result = match code { | ||
Some(code) => code.to_string(), | ||
None => String::from("Unknown"), | ||
}; | ||
match filteree.as_str() { | ||
"success" => { | ||
if response.status().is_success() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
|
||
"client_error" => { | ||
if response.status().is_client_error() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
|
||
"redirection" => { | ||
if response.status().is_redirection() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
|
||
"server_error" => { | ||
if response.status().is_server_error() { | ||
println!("{} {} {}", result.green(), word, target.clone().magenta()); | ||
} | ||
}, | ||
_ => println!("Unknown Type") | ||
} | ||
}, | ||
_ => println!("Unknown Type") | ||
} | ||
} | ||
} | ||
Ok(()) | ||
} |
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