Scanner

Struct Scanner 

Source
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: u32

Index of network interface

§if_name: String

Name of network interface

§src_mac: String

Source MAC Address

§dst_mac: String

Destination MAC Address (Gateway)

§src_ip: IpAddr

Source IP Address

§src_port: u16

Source port

§probe_targets: Vec<ProbeTarget>

Probe Targets

§probe_types: Vec<ProbeType>

Probe Types

§timeout: Duration

Timeout setting

§wait_time: Duration

Wait time after send task is finished

§send_rate: Duration

Packet send rate

§probe_results: Vec<ProbeResult>

Result of probes

Implementations§

Source§

impl Scanner

Source

pub fn new(src_ip: IpAddr) -> Result<Scanner, String>

Create new fingerprinter with interfece IP

Source

pub fn new_with_gateway_ip( src_ip: IpAddr, gateway_ip: IpAddr, ) -> Result<Scanner, String>

Create new fingerprinter with interfece IP and gateway IP

Source

pub fn len(&self) -> usize

get scan count

Source

pub fn set_method(&mut self, cmd: &Vec<String>) -> Result<(), String>

Set method

Source

pub fn set_src_port(&mut self, src_port: u16)

Set source port number

Source

pub fn add_probe_target(&mut self, dst_info: ProbeTarget)

Add probe target (IP address and tcp/udp port)

Source

pub fn set_probe_targets(&mut self, probe_targets: Vec<ProbeTarget>)

Set probe targets

Source

pub fn add_probe_type(&mut self, probe_type: ProbeType)

Add probe type

Source

pub fn set_probe_types(&mut self, probe_types: Vec<ProbeType>)

Set probe types

Source

pub fn set_full_probe(&mut self)

Set all probe types

Source

pub fn set_timeout(&mut self, timeout: Duration)

Set probe timeout

Source

pub fn set_wait_time(&mut self, wait_time: Duration)

Set wait-time after the sending task is completed

Source

pub fn set_send_rate(&mut self, send_rate: Duration)

Set packet send rate

Source

pub fn get_probe_results(&self) -> Vec<ProbeResult>

Get probe result

Source

pub fn run_scan(&mut self)

Run probe with the current settings

Source

pub fn scan(&mut self, _pstop: Option<Arc<Mutex<bool>>>) -> Vec<ProbeResult>

Run probe and return result

Trait Implementations§

Source§

impl Debug for Scanner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V