sniff things wip
This commit is contained in:
parent
06d4e558cd
commit
e8b2411864
2 changed files with 14 additions and 1 deletions
|
|
@ -1 +1,11 @@
|
||||||
// Here we will recieve bytes and try to get their destanation & apply Rules for them.
|
// Here we will recieve bytes and try to get their destanation & apply Rules for them.
|
||||||
|
use crate::config::Config;
|
||||||
|
|
||||||
|
struct PacketInfo;
|
||||||
|
pub fn sniff_raw_packets(packet: &[u8]) -> Result<PacketInfo, Box<dyn std::error::Error + Send + Sync + 'static>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn apply_rules(config: Config, pinfo: PacketInfo) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Here we iniitialize systems crucial for nsc
|
// Here we iniitialize systems crucial for nsc
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
use sniffing::headers::sniff_raw_packets;
|
||||||
|
|
||||||
pub fn init() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
|
pub fn init() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
|
||||||
let mut config = tun::Configuration::default();
|
let mut config = tun::Configuration::default();
|
||||||
|
|
@ -20,6 +21,8 @@ pub fn init() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>>
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let amount = dev.read(&mut buf)?;
|
let amount = dev.read(&mut buf)?;
|
||||||
println!("{:?}", &buf[0..amount]);
|
sniff_raw_packets(&buf[0..amount]);
|
||||||
|
dbg!("{:?}", &buf[0..amount]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue