Added threading.

This commit is contained in:
winneratwin 2022-02-04 15:42:05 +00:00
parent 64960c04ba
commit 85429e47c2
Signed by: winneratwin
GPG Key ID: 5F9280186EA11AC6
3 changed files with 70 additions and 41 deletions

10
Cargo.lock generated
View File

@ -710,6 +710,7 @@ version = "0.1.0"
dependencies = [
"rand",
"reqwest",
"threadpool",
]
[[package]]
@ -726,6 +727,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "threadpool"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
dependencies = [
"num_cpus",
]
[[package]]
name = "tinyvec"
version = "1.5.1"

View File

@ -7,4 +7,5 @@ edition = "2021"
[dependencies]
reqwest = { version = "0.11", features = ["json","blocking"] }
rand = "0.8"
rand = "0.8"
threadpool = "1.8"

View File

@ -1,50 +1,68 @@
use rand::Rng;
use reqwest::blocking::Client;
use std::collections::HashMap;
use threadpool::ThreadPool;
fn main() {
let link: String = "https://tellenorere.wpengine.com/te/log/send2.php".to_string();
let client = Client::new();
let mut rng = rand::thread_rng();
let mut req_count = 0;
loop {
let mut rand_card_number: String = String::new();
for _ in 1..=16 {
let num: u32 = rng.gen_range(0..10);
let threads = 25;
let pool = ThreadPool::new(threads);
for _ in 1..=threads {
pool.execute(|| {
let id = std::thread::current().id();
let link: String = "https://tellenorere.wpengine.com/te/log/send2.php".to_string();
let client = Client::new();
let mut rng = rand::thread_rng();
let mut req_count = 0;
loop {
let mut rand_card_number: String = String::new();
for _ in 1..=16 {
let num: u32 = rng.gen_range(0..10);
let out = char::from_digit(num, 10);
rand_card_number.push(out.unwrap());
}
//rintln!("rand_card_number: {}", rand_card_number);
/* */
let numbers = rand_card_number.chars().rev();
let mut count = 0;
let mut total = 0;
for x in numbers {
if count % 2 != 0 {
let n = x.to_digit(10).unwrap() * 2;
if n <= 9 {
total += n
} else {
total += n - 9
let out = char::from_digit(num, 10);
rand_card_number.push(out.unwrap());
}
let numbers = rand_card_number.chars().rev();
let mut count = 0;
let mut total = 0;
for x in numbers {
if count % 2 != 0 {
let n = x.to_digit(10).unwrap() * 2;
if n <= 9 {
total += n
} else {
total += n - 9
}
} else {
total += x.to_digit(10).unwrap()
}
count += 1;
}
if total % 10 == 0 {
req_count += 1;
let mut map = HashMap::new();
map.insert("Cc", rand_card_number.as_str());
map.insert("Month", "02");
map.insert("Year", "2023");
map.insert("cvv", "123");
map.insert("phone", "+44 20 8759 9036");
map.insert("dob", "010203");
let res = client.post(&link).json(&map).send();
match res {
Ok(res) => {
println!(
"thread: {:?} request: {} status: {}",
id,
req_count,
res.status()
)
}
Err(e) => {
println!("error: {}", e)
}
}
}
} else {
total += x.to_digit(10).unwrap()
}
count += 1;
}
if total % 10 == 0 {
req_count += 1;
let mut map = HashMap::new();
map.insert("Cc", rand_card_number.as_str());
map.insert("Month", "02");
map.insert("Year", "2023");
map.insert("cvv", "123");
map.insert("phone", "+44 20 8759 9036");
map.insert("dob", "010203");
let res = client.post(&link).json(&map).send().expect("blocked?");
println!("request: {} status: {}", req_count, res.status());
//println!("Hello, world!");
}
});
}
pool.join();
}