logo
pub struct Opts {
    pub ips: Vec<String>,
    pub ports: Vec<String>,
    pub src_ip: String,
    pub timeout: u64,
    pub wait_time: u64,
    pub rate: u64,
    pub scan: ScanOrderType,
    pub model: ScanModelType,
    pub scripts: ScriptsRequired,
    pub no_gui: bool,
    pub verbose: u8,
    pub command: Vec<String>,
}
Expand description

Opts

Fields

ips: Vec<String>

host list; example: “192.168.1.1”, “192.168.1.0/24”, “192.168.8-9.80-100”, “baidu.com”

ports: Vec<String>

port list; Example: 80,443,8080,100-1000.

src_ip: String

use it ip match network interface of hardware;

timeout: u64

The timeout in milliseconds before a port is assumed to be closed; default is 3_600_000ms

wait_time: u64

Waiting time after packet sending task is completed; default is 3000ms

rate: u64

Packet sending interval(0 for unlimited); default is 0

scan: ScanOrderType

send type; [ Icmp, TcpConnect, Udp, Tcp, TcpSyn]; default: None;

model: ScanModelType

scan type; [ Sync, Async, Os, Service, Dns, Traceroute ]; default: sync

scripts: ScriptsRequired

scripts

no_gui: bool

no gui window

verbose: u8

Verbose mode (-v, -vv, -vvv, etc.)

command: Vec<String>

Extend command; example: e-libscanner –ips baidu.com 192.168.1.0/24 –model sync –scan icmp –no-gui – -AS commads: – -AS: ARP Spoofing,

Implementations

Example
let mut scanner = Opts::new(Some(&[
"e-libscanner",
"--ips",
"192.168.80.0/21",
"192.168.20-21.15-20",
"baidu.com",
"--model",
"sync",
"--scan",
"Icmp",
"--no-gui",
"--",
"-AS",
]))
.init()?
.downcast::<sync_scan::Scanner>()
.unwrap();
let rx = scanner.get_progress_receiver();
// Run scan
let handle = thread::spawn(move || scanner.scan(None));
// Print progress
while let Ok(socket_addr) = rx.lock().unwrap().recv() {
println!("Check: {}", socket_addr);
}
let result = handle.join().unwrap();
// Print results
println!("Status: {:?}", result.scan_status);
println!("UP Hosts:");
let len = result.ips.len();
for host in result.ips {
println!("{:?}", host);
}
println!("Scan Time: {:?} count[ {} ]", result.scan_time, len);

init opts data

Trait Implementations

Formats the value using the given formatter. Read more

Returns clap::App corresponding to the struct.

Builds the struct from clap::ArgMatches. It’s guaranteed to succeed if matches originates from an App generated by StructOpt::clap called on the same type, otherwise it must panic. Read more

Builds the struct from the command line arguments (std::env::args_os). Calls clap::Error::exit on failure, printing the error message and aborting the program. Read more

Builds the struct from the command line arguments (std::env::args_os). Unlike StructOpt::from_args, returns clap::Error on failure instead of aborting the program, so calling .exit is up to you. Read more

Gets the struct from any iterator such as a Vec of your making. Print the error message and quit the program in case of failure. Read more

Gets the struct from any iterator such as a Vec of your making. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.