Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcbax committed Apr 23, 2021
1 parent 5985e11 commit 1fdcbd3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/request_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ pub fn build_form(fields: PostFields, data: PostData) -> multipart::Form {
}

pub fn build_request(form: multipart::Form, url: String) -> Request {
let client = reqwest::blocking::Client::new();
let client = reqwest::blocking::Client::builder().user_agent(fakeit::user_agent::random_platform()).build().unwrap();
return client.post(url).multipart(form).build().unwrap();
}
22 changes: 17 additions & 5 deletions src/thread_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use crate::types::*;
use crate::request_builder::*;
use crate::generator::*;

use std::io::Write;

pub fn execute(fields: PostFields, url: String, domain: String, threads: u64, debug: bool) {
for _ in 0..threads {
let fields_clone = fields.clone();
Expand Down Expand Up @@ -30,10 +32,13 @@ pub fn execute(fields: PostFields, url: String, domain: String, threads: u64, de
) {
Ok(o) => Some(o),
Err(e) => {
println!("{:?}", e);
if debug_clone1 {
println!("{:?}", e);
std::io::stdout().flush().ok().expect("Could not flush stdout");
} else {
eprint!("✘");
eprint!("x");
std::io::stderr().flush().ok().expect("Could not flush stdout");
}
None
}
Expand All @@ -42,13 +47,20 @@ pub fn execute(fields: PostFields, url: String, domain: String, threads: u64, de
let res = response.unwrap();
if res.status().is_success() | res.status().is_redirection() {
if debug_clone1 {
println!("{:?}", res.headers());
println!("{:?}", res.text());
println!("{:?}", res);
std::io::stdout().flush().ok().expect("Could not flush stdout");
} else {
print!("✔");
print!(".");
std::io::stdout().flush().ok().expect("Could not flush stdout");
}
} else {
print!("✘");
if debug_clone1 {
println!("{:?}", res);
std::io::stdout().flush().ok().expect("Could not flush stdout");
} else {
print!("x");
std::io::stdout().flush().ok().expect("Could not flush stdout");
}
}
}
}
Expand Down

0 comments on commit 1fdcbd3

Please sign in to comment.