impl: started writting FakeDNS server (or 'dns hijack')
This commit is contained in:
parent
0d81bae32a
commit
927299baad
6 changed files with 183 additions and 43 deletions
42
src/sniffing/types.rs
Normal file
42
src/sniffing/types.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#[derive(Debug, PartialEq)]
|
||||
pub enum PacketInfo {
|
||||
// <https://www.geeksforgeeks.org/computer-networks/what-is-ipv4/>
|
||||
V4 {
|
||||
src_ip: Ipv4,
|
||||
src_port: Port,
|
||||
dst_ip: Ipv4,
|
||||
dst_port: Port,
|
||||
protocol: Protocol,
|
||||
dns: bool,
|
||||
},
|
||||
// <https://www.geeksforgeeks.org/computer-networks/internet-protocol-version-6-ipv6-header/>
|
||||
V6 {
|
||||
src_ip: Ipv6,
|
||||
src_port: Port,
|
||||
dst_ip: Ipv6,
|
||||
dst_port: Port,
|
||||
protocol: Protocol,
|
||||
dns: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Protocol {
|
||||
TCP,
|
||||
UDP,
|
||||
Unsupported(u8),
|
||||
}
|
||||
pub type SourceV4Ip = Ipv4;
|
||||
pub type SourceV6Ip = Ipv6;
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum IpVersion {
|
||||
V4,
|
||||
V6,
|
||||
}
|
||||
pub type Ipv4 = [u8; 4];
|
||||
pub type Ipv6 = [u16; 8];
|
||||
pub type Port = u16;
|
||||
|
||||
pub type GenericError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
pub type SniffedPacket = Result<PacketInfo, Box<dyn std::error::Error + Send + Sync + 'static>>;
|
||||
pub type Packet = [u8];
|
||||
Loading…
Add table
Add a link
Reference in a new issue