mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-10-22 15:12:23 +00:00
pcap last version, added description on device list
This commit is contained in:
parent
25d2c08d6c
commit
5837e0678a
3 changed files with 7 additions and 6 deletions
|
|
@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
pcap = "0.9.2"
|
||||
pcap = "0.10.1"
|
||||
etherparse = "0.12.0"
|
||||
clap = { version = "3.2.6", features = ["derive"] }
|
||||
chrono = "0.4.20"
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ fn main() {
|
|||
fn print_device_list() {
|
||||
println!("\r");
|
||||
for dev in Device::list().expect("Error retrieving device list\r\n") {
|
||||
print!("{}{}{}", "\r\tDevice: ".cyan(), dev.name.cyan(),
|
||||
"\r\n\t\tAddresses: ".cyan());
|
||||
print!("{}{} ({}){}", "\r\tDevice: "/*.cyan()*/, dev.name.cyan(), dev.desc.unwrap().cyan(),
|
||||
"\r\n\t\tAddresses: "/*.cyan()*/);
|
||||
if dev.addresses.len() == 0 {
|
||||
println!("\r");
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ fn print_device_list() {
|
|||
fn retrieve_device(adapter: &mut String) -> Option<Device> {
|
||||
let mut found_device = None;
|
||||
if (*adapter).eq(&"default".to_string()) {
|
||||
*adapter = Device::lookup().expect("Error retrieving default network adapter\r\n").name;
|
||||
*adapter = Device::lookup().expect("Error retrieving default network adapter\r\n").expect("Error: no suitable devices\r\n").name;
|
||||
}
|
||||
let dev_list = Device::list().expect("Unable to retrieve network adapters list\r\n");
|
||||
for device in dev_list {
|
||||
|
|
|
|||
|
|
@ -60,8 +60,9 @@ pub fn parse_packets_loop(device: Device, lowest_port: u16, highest_port: u16,
|
|||
|
||||
if *status == Status::Running {
|
||||
drop(status);
|
||||
match cap.next() {
|
||||
Err(_) => {
|
||||
match cap.next_packet() {
|
||||
Err(e) => {
|
||||
println!("ERROR: {:?}", e); // Debug
|
||||
continue;
|
||||
}
|
||||
Ok(packet) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue