@@ -3,6 +3,7 @@ extern crate rustc_serialize;
3
3
extern crate openssl;
4
4
#[ macro_use] extern crate log;
5
5
extern crate env_logger;
6
+ extern crate num_cpus;
6
7
7
8
use docopt:: Docopt ;
8
9
use std:: net:: TcpStream ;
@@ -29,7 +30,7 @@ Options:
29
30
--cycles=C Total number of additional \" keepalive\" headers to be sent. [default: 10]
30
31
--domain=D Override the domain name for SSL connections (e.g., if you're connecting to a raw IP address)
31
32
--repeat Perform the attack repeatedly (WARNING - Can produce a DoS condition!)
32
- --threads=T The number of concurrent threads to spin off. [default: 1]
33
+ --threads=T The number of concurrent threads to spin off. Defaults to the number of CPUs.
33
34
" ;
34
35
35
36
#[ derive( Debug , RustcDecodable ) ]
@@ -42,7 +43,7 @@ struct Args {
42
43
flag_nofinalize : bool ,
43
44
flag_domain : Option < String > ,
44
45
flag_repeat : bool ,
45
- flag_threads : usize ,
46
+ flag_threads : Option < usize > ,
46
47
cmd_get : bool ,
47
48
cmd_post : bool
48
49
}
@@ -87,7 +88,7 @@ fn main() {
87
88
let cycles = args. flag_cycles ;
88
89
let timeout = args. flag_timeout ;
89
90
let repeat = args. flag_repeat ;
90
- let threads = args. flag_threads ;
91
+ let threads = args. flag_threads . unwrap_or ( num_cpus :: get ( ) ) ;
91
92
let ssl = args. flag_ssl ;
92
93
let cmd_get = args. cmd_get ;
93
94
let cmd_post = args. cmd_post ;
0 commit comments