pub struct Scanner {
pub if_index: u32,
pub if_name: String,
pub src_mac: String,
pub dst_mac: String,
pub src_ip: IpAddr,
pub src_port: u16,
pub probe_targets: Vec<ProbeTarget>,
pub probe_types: Vec<ProbeType>,
pub timeout: Duration,
pub wait_time: Duration,
pub send_rate: Duration,
pub probe_results: Vec<ProbeResult>,
}Available on crate feature
os only.Expand description
Struct for fingerprint probe
§Example
fn main() -> Result<(), String> {
#[cfg(feature = "os")]
{
use e_libscanner::os;
use e_libscanner::Opts;
// more command information use: -h
let mut scanner = Opts::new(Some(&[
"e-libscanner",
"--ips",
"192.168.80.8",
"192.168.80.1",
"--ports",
"80",
"135",
"554",
"8000",
"22",
"--model",
"os",
"--no-gui",
"--",
"-AS",
]))?
.init()?
.downcast::<os::Scanner>()
.unwrap();
let results = scanner.scan(None);
for result in results {
println!("{}", result.ip_addr);
println!("{:?}", result.icmp_echo_result);
println!("{:?}", result.icmp_timestamp_result);
println!("{:?}", result.icmp_address_mask_result);
println!("{:?}", result.icmp_information_result);
println!("{:?}", result.icmp_unreachable_ip_result);
println!("{:?}", result.icmp_unreachable_data_result);
println!("{:?}", result.tcp_syn_ack_result);
println!("{:?}", result.tcp_rst_ack_result);
println!("{:?}", result.tcp_ecn_result);
println!("{:?}", result.tcp_header_result);
println!();
}
Ok(())
}
}Fields§
§if_index: u32Index of network interface
if_name: StringName of network interface
src_mac: StringSource MAC Address
dst_mac: StringDestination MAC Address (Gateway)
src_ip: IpAddrSource IP Address
src_port: u16Source port
probe_targets: Vec<ProbeTarget>Probe Targets
probe_types: Vec<ProbeType>Probe Types
timeout: DurationTimeout setting
wait_time: DurationWait time after send task is finished
send_rate: DurationPacket send rate
probe_results: Vec<ProbeResult>Result of probes
Implementations§
Source§impl Scanner
impl Scanner
Sourcepub fn new(src_ip: IpAddr) -> Result<Scanner, String>
pub fn new(src_ip: IpAddr) -> Result<Scanner, String>
Create new fingerprinter with interfece IP
Sourcepub fn new_with_gateway_ip(
src_ip: IpAddr,
gateway_ip: IpAddr,
) -> Result<Scanner, String>
pub fn new_with_gateway_ip( src_ip: IpAddr, gateway_ip: IpAddr, ) -> Result<Scanner, String>
Create new fingerprinter with interfece IP and gateway IP
Sourcepub fn set_src_port(&mut self, src_port: u16)
pub fn set_src_port(&mut self, src_port: u16)
Set source port number
Sourcepub fn add_probe_target(&mut self, dst_info: ProbeTarget)
pub fn add_probe_target(&mut self, dst_info: ProbeTarget)
Add probe target (IP address and tcp/udp port)
Sourcepub fn set_probe_targets(&mut self, probe_targets: Vec<ProbeTarget>)
pub fn set_probe_targets(&mut self, probe_targets: Vec<ProbeTarget>)
Set probe targets
Sourcepub fn add_probe_type(&mut self, probe_type: ProbeType)
pub fn add_probe_type(&mut self, probe_type: ProbeType)
Add probe type
Sourcepub fn set_probe_types(&mut self, probe_types: Vec<ProbeType>)
pub fn set_probe_types(&mut self, probe_types: Vec<ProbeType>)
Set probe types
Sourcepub fn set_full_probe(&mut self)
pub fn set_full_probe(&mut self)
Set all probe types
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set probe timeout
Sourcepub fn set_wait_time(&mut self, wait_time: Duration)
pub fn set_wait_time(&mut self, wait_time: Duration)
Set wait-time after the sending task is completed
Sourcepub fn set_send_rate(&mut self, send_rate: Duration)
pub fn set_send_rate(&mut self, send_rate: Duration)
Set packet send rate
Sourcepub fn get_probe_results(&self) -> Vec<ProbeResult>
pub fn get_probe_results(&self) -> Vec<ProbeResult>
Get probe result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scanner
impl RefUnwindSafe for Scanner
impl Send for Scanner
impl Sync for Scanner
impl Unpin for Scanner
impl UnwindSafe for Scanner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more