Expand description
This crate exposes the internal functionality of the RustScan port scanner.
§Example: perform a scan against localhost
The core scanning behaviour is managed by
Scanner which in turn requires a
PortStrategy:
use async_std::task::block_on;
use std::{net::IpAddr, time::Duration};
use rustscan::input::{PortRange, ScanOrder};
use rustscan::port_strategy::PortStrategy;
use rustscan::scanner::Scanner;
fn main() {
let addrs = vec!["127.0.0.1".parse::<IpAddr>().unwrap()];
let range = PortRange {
start: 1,
end: 1_000,
};
let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random); // can be serial, random or manual https://github.com/RustScan/RustScan/blob/master/src/port_strategy/mod.rs
let scanner = Scanner::new(
&addrs, // the addresses to scan
10, // batch_size is how many ports at a time should be scanned
Duration::from_millis(100), //T imeout is the time RustScan should wait before declaring a port closed. As datatype Duration.
1, // Tries, how many retries should RustScan do?
true, // greppable is whether or not RustScan should print things, or wait until the end to print only the ip
strategy, // the port strategy used
true, // accessible, should the output be A11Y compliant?
vec![9000], // What ports should RustScan exclude?
false, // is this a UDP scan?
);
let scan_result = block_on(scanner.run());
println!("{:?}", scan_result);
}Modules§
- address
- Provides functions to parse input IP addresses, CIDRs or files.
- benchmark
- Provides functionality to capture timing information for scans.
- input
- Provides a means to read, parse and hold configuration options for scans.
- port_
strategy - Provides a means to hold configuration options specifically for port scanning.
- scanner
- Core functionality for actual scanning behaviour.
- scripts
- Scripting Engine to run scripts based on tags.
- tui
- Utilities for terminal output during scanning.
Macros§
- detail
- funny_
opening - output
- warning
- Terminal User Interface Module for RustScan Defines macros to use