Skip to content

Commit

Permalink
Add support for --tcp-connect-threads, it's the equivalent of Nmap's …
Browse files Browse the repository at this point in the history
…--min-rate

Signed-off-by: Eduard Tolosa <edu4rdshl@protonmail.com>
  • Loading branch information
Edu4rdSHL committed Apr 4, 2022
1 parent 2f6c1cb commit 8968697
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ pub fn get_args() -> Args {
.unwrap()
},
),
tcp_connect_threads: value_t!(matches, "tcp-connect-threads", usize).unwrap_or_else(|_| {
return_value_or_default(&settings, "screenshots_threads", 500.to_string())
.parse::<usize>()
.unwrap()
}),
resolver_timeout: value_t!(matches, "resolver-timeout", u64).unwrap_or_else(|_| {
return_value_or_default(&settings, "resolver_timeout", 3.to_string())
.parse::<u64>()
Expand Down
4 changes: 4 additions & 0 deletions src/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ args:
help: Number of IPs that will be port-scanned at the same time. Default is 10.
long: parallel-ip-ports-scan
takes_value: true
- tcp-connect-threads:
help: Number of threads to use for TCP connections - It's the equivalent of Nmap's --min-rate. Default is 500.
long: tcp-connect-threads
takes_value: true
- custom-resolvers:
help: Path to a file (or files) containing a list of DNS IP address. If no specified then Google, Cloudflare and Quad9 DNS servers are used.
long: resolvers
Expand Down
2 changes: 1 addition & 1 deletion src/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ fn async_resolver_engine(
let rt = tokio::runtime::Runtime::new().unwrap();
let handle = rt.handle().to_owned();

let tcp_connect_threads = args.lightweight_threads;
let tcp_connect_threads = args.tcp_connect_threads;
let parallel_ip_ports_scan = if ips_to_scan.len() < args.parallel_ip_ports_scan {
ips_to_scan.len()
} else {
Expand Down
1 change: 1 addition & 0 deletions src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct Args {
pub commit_to_db_counter: usize,
pub lightweight_threads: usize,
pub screenshots_threads: usize,
pub tcp_connect_threads: usize,
pub parallel_ip_ports_scan: usize,
pub resolver_timeout: u64,
pub tcp_connect_timeout: u64,
Expand Down

0 comments on commit 8968697

Please sign in to comment.