Compare commits

...

8 Commits

Author SHA1 Message Date
S.B 3403cec7f9 Merge pull request #27 from s-b-repo/rust-2024-edition-migration
Rust 2024 edition migration
2025-11-26 16:48:21 +02:00
S.B 99e31b1c2f Update Cargo.toml 2025-11-24 15:03:07 +02:00
S.B c9e93614a4 Add files via upload 2025-11-24 14:59:46 +02:00
S.B 227dc38663 Delete preview.png 2025-11-24 14:59:29 +02:00
S.B b1ca5f1151 Add files via upload 2025-11-24 14:58:34 +02:00
S.B 6c153eee99 Delete src directory 2025-11-24 14:56:45 +02:00
S.B c9712dc4a9 Add files via upload 2025-11-24 14:53:44 +02:00
S.B be1c4158af Delete src directory 2025-11-24 14:52:09 +02:00
6 changed files with 34 additions and 9 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
[package]
name = "rustsploit"
version = "0.3.5"
edition = "2021"
edition = "2024"
build = "build.rs"
[[bin]]
@@ -96,7 +96,7 @@ hickory-proto = "0.24"
# Misc utilities
once_cell = "1.19"
home = "=0.5.11" # pinned for edition 2021 compatibility
home = "0.5" # updated for edition 2024 compatibility
[build-dependencies]
regex = "1.11"
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 435 KiB

@@ -293,13 +293,13 @@ async fn try_fortinet_login(
form_data.insert("password", password.to_string());
form_data.insert("ajax", "1".to_string());
if let Some(ref r) = realm {
if let Some(r) = realm {
if !r.is_empty() {
form_data.insert("realm", r.clone());
}
}
if let Some(ref token) = csrf_token {
if let Some(token) = csrf_token {
form_data.insert("magic", token.clone());
}
@@ -368,7 +368,7 @@ async fn try_fortinet_login(
// Check redirect location
if status.as_u16() == 302 {
if let Some(ref loc_str) = location_header {
if let Some(loc_str) = location_header {
if loc_str.contains("/remote/index")
|| loc_str.contains("portal")
|| loc_str.contains("index")
+8
View File
@@ -742,6 +742,10 @@ async fn syn_probe_single(ip: &Ipv4Addr, port: u16, timeout: Duration) -> Result
let mut buf = [MaybeUninit::<u8>::uninit(); 1500];
match sock_clone.recv_from(&mut buf) {
Ok((len, addr)) => {
// Safe conversion: we know len is valid and within buf bounds
if len > buf.len() {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "Invalid buffer length"));
}
let slice = unsafe { std::slice::from_raw_parts(buf.as_ptr() as *const u8, len) };
let sock_addr = addr.as_socket().ok_or_else(|| std::io::Error::new(std::io::ErrorKind::Other, "convert"))?;
Ok(Some((slice.to_vec(), sock_addr)))
@@ -917,6 +921,10 @@ async fn ack_probe_single(ip: &Ipv4Addr, port: u16, timeout: Duration) -> Result
let mut buf = [MaybeUninit::<u8>::uninit(); 1500];
match sock_clone.recv_from(&mut buf) {
Ok((len, addr)) => {
// Safe conversion: we know len is valid and within buf bounds
if len > buf.len() {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "Invalid buffer length"));
}
let slice = unsafe { std::slice::from_raw_parts(buf.as_ptr() as *const u8, len) };
let sock_addr = addr.as_socket().ok_or_else(|| std::io::Error::new(std::io::ErrorKind::Other, "convert"))?;
Ok(Some((slice.to_vec(), sock_addr)))
@@ -247,6 +247,10 @@ async fn send_and_receive_one(
let mut buf = [MaybeUninit::<u8>::uninit(); 1500];
match sock_clone.recv_from(&mut buf) {
Ok((len, addr)) => {
// Safe conversion: we know len is valid and within buf bounds
if len > buf.len() {
return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "Invalid buffer length"));
}
let slice = unsafe { std::slice::from_raw_parts(buf.as_ptr() as *const u8, len) };
let sock_addr = addr.as_socket().ok_or_else(|| std::io::Error::new(std::io::ErrorKind::Other, "convert"))?;
Ok(Some((slice.to_vec(), sock_addr)))
@@ -416,6 +420,7 @@ pub async fn run(target: &str) -> Result<()> {
stdin().read_line(&mut user_input).expect("Failed to read line");
if user_input.trim().to_lowercase() == "yes" {
// Safe wrapper for geteuid - it's a simple system call that cannot fail
let euid = unsafe { libc::geteuid() };
if euid != 0 {
println!("don't lie");
+16 -4
View File
@@ -7,6 +7,7 @@ use rand::prelude::*;
use std::env;
use std::io::{self, Write};
use std::collections::HashSet;
use std::sync::Mutex;
const MAX_INPUT_LENGTH: usize = 4096;
const MAX_PROXY_LIST_SIZE: usize = 10_000;
@@ -524,16 +525,27 @@ fn pick_random_untried_proxy(proxy_list: &[String], tried_proxies: &HashSet<Stri
}
}
// Thread-safe environment variable access
static ENV_MUTEX: Mutex<()> = Mutex::new(());
/// Sets ALL_PROXY so reqwest uses it for all requests (including socks4, socks5, http, https)
/// Thread-safe wrapper around env::set_var
fn set_all_proxy_env(proxy: &str) {
env::set_var("ALL_PROXY", proxy);
let _guard = ENV_MUTEX.lock().unwrap();
unsafe {
env::set_var("ALL_PROXY", proxy);
}
}
/// Clears environment variables for direct connection
/// Thread-safe wrapper around env::remove_var
fn clear_proxy_env_vars() {
env::remove_var("ALL_PROXY");
env::remove_var("HTTP_PROXY");
env::remove_var("HTTPS_PROXY");
let _guard = ENV_MUTEX.lock().unwrap();
unsafe {
env::remove_var("ALL_PROXY");
env::remove_var("HTTP_PROXY");
env::remove_var("HTTPS_PROXY");
}
}
fn split_command(input: &str) -> Option<(String, String)> {