e_libscanner/frame/
mod.rs1#[doc(hidden)]
2pub mod result;
3use pnet_datalink::MacAddr;
4use std::collections::HashSet;
5use std::net::IpAddr;
6use std::time::Duration;
7
8#[derive(Clone, Debug)]
10pub enum ScanType {
11 TcpSynScan,
15 TcpConnectScan,
19 IcmpPingScan,
23 TcpPingScan,
27 UdpPingScan,
29}
30
31#[derive(Clone, Debug)]
35pub struct Destination {
36 pub dst_ip: IpAddr,
38 pub dst_ports: Vec<u16>,
40}
41
42impl Destination {
43 pub fn new(ip_addr: IpAddr, ports: Vec<u16>) -> Destination {
45 Destination {
46 dst_ip: ip_addr,
47 dst_ports: ports,
48 }
49 }
50 pub fn new_with_port_range(ip_addr: IpAddr, start_port: u16, end_port: u16) -> Destination {
52 let mut ports: Vec<u16> = vec![];
53 for i in start_port..end_port + 1 {
54 ports.push(i);
55 }
56 Destination {
57 dst_ip: ip_addr,
58 dst_ports: ports,
59 }
60 }
61 pub fn set_dst_ip(&mut self, ip_addr: IpAddr) {
63 self.dst_ip = ip_addr;
64 }
65 pub fn get_dst_ip(&self) -> IpAddr {
67 self.dst_ip.clone()
68 }
69 pub fn set_dst_port(&mut self, ports: Vec<u16>) {
71 self.dst_ports = ports;
72 }
73 pub fn get_dst_port(&self) -> Vec<u16> {
75 self.dst_ports.clone()
76 }
77}
78
79#[derive(Clone, Debug)]
80pub(crate) struct ScanSetting {
81 pub(crate) if_index: u32,
82 #[allow(dead_code)]
83 pub(crate) src_mac: MacAddr,
84 #[allow(dead_code)]
85 pub(crate) dst_mac: MacAddr,
86 pub(crate) src_ip: IpAddr,
87 pub(crate) src_port: u16,
88 pub(crate) destinations: Vec<Destination>,
89 pub(crate) ip_set: HashSet<IpAddr>,
90 pub(crate) timeout: Duration,
91 pub(crate) wait_time: Duration,
92 #[allow(dead_code)]
93 pub(crate) send_rate: Duration,
94 pub(crate) scan_type: ScanType,
95 #[allow(dead_code)]
96 pub(crate) hosts_concurrency: usize,
97 #[allow(dead_code)]
98 pub(crate) ports_concurrency: usize,
99}