Quick Network Scanner Library
Rust library for scanning network hosts asynchronously.
Currently only TCP connect scan is supported.
NOTE: in order to properly use the library you may need to increase the maximum
allowed open files. E.g.:
ulimit -n 10000
See the library on crates.io.
Usage
Dependencies (Cargo.toml):
[dependencies]
qscan = "0.5.0"
tokio = { version = "1", features = ["rt-multi-thread"] }
Alternatively, in order enable qscan::QScanTcpConnectResult serialization,
activate serialize feature:
[dependencies]
qscan = { version = "0.5.0" , features = ["serialize"] }
tokio = { version = "1", features = ["rt-multi-thread"] }
and then (src/main.rs):
use qscan::{QSPrintMode, QScanTcpConnectState, QScanType, QScanner};
use tokio::runtime::Runtime;
pub fn main() {
let mut scanner = QScanner::new("8.8.8.8,127.0.0.1", "53,80,443");
scanner.set_batch(5000);
scanner.set_timeout_ms(2000);
scanner.set_ntries(1);
scanner.set_scan_type(QScanType::TcpConnect);
scanner.set_print_mode(QSPrintMode::NonRealTime);
let res = Runtime::new().unwrap().block_on(scanner.scan_tcp_connect());
for sa in res {
if sa.state == QScanTcpConnectState::Open {
println!("{}", sa.target);
}
}
}
See also the provided example and qsc utility.