Struct e_libscanner::Opts
source · [−]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: Stringuse it ip match network interface of hardware;
timeout: u64The timeout in milliseconds before a port is assumed to be closed; default is 3_600_000ms
wait_time: u64Waiting time after packet sending task is completed; default is 3000ms
rate: u64Packet sending interval(0 for unlimited); default is 0
scan: ScanOrderTypesend type; [ Icmp, TcpConnect, Udp, Tcp, TcpSyn]; default: None;
model: ScanModelTypescan type; [ Sync, Async, Os, Service, Dns, Traceroute ]; default: sync
scripts: ScriptsRequiredscripts
no_gui: boolno gui window
verbose: u8Verbose 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
sourceimpl Opts
impl Opts
sourcepub fn new<I>(args: Option<I>) -> Result<Self, String> where
Self: Sized,
I: IntoIterator,
I::Item: Into<OsString> + Clone,
pub fn new<I>(args: Option<I>) -> Result<Self, String> where
Self: Sized,
I: IntoIterator,
I::Item: Into<OsString> + Clone,
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);Trait Implementations
sourceimpl StructOpt for Opts
impl StructOpt for Opts
sourcefn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
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
sourcefn from_args() -> Self
fn from_args() -> Self
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
sourcefn from_args_safe() -> Result<Self, Error>
fn from_args_safe() -> Result<Self, Error>
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
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
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
sourcefn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
fn from_iter_safe<I>(iter: I) -> Result<Self, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<OsString>,
<I as IntoIterator>::Item: Clone,
Gets the struct from any iterator such as a Vec of your making. Read more
Auto Trait Implementations
impl RefUnwindSafe for Opts
impl Send for Opts
impl Sync for Opts
impl Unpin for Opts
impl UnwindSafe for Opts
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
