MCPcopy Create free account
hub / github.com/RizeCrime/linuxblaster_control / main

Function main

sniffer/src/main.rs:544–574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

542}
543
544fn main() {
545 let args: Vec<String> = env::args().skip(1).collect();
546
547 match args.first().map(String::as_str) {
548 Some("--all") | Some("-a") => {
549 let mut files: Vec<String> = fs::read_dir("captures")
550 .expect("Cannot read ./captures")
551 .filter_map(|e| {
552 let e = e.ok()?;
553 let p = e.path();
554 if p.extension().and_then(|s| s.to_str()) == Some("pcapng") {
555 Some(p.to_string_lossy().into_owned())
556 } else {
557 None
558 }
559 })
560 .collect();
561 files.sort();
562 for path in &files {
563 write_parsed(path);
564 }
565 }
566 Some(path) => write_parsed(path),
567 None => {
568 eprintln!("Usage:");
569 eprintln!(" cargo run -- <file.pcapng> parse a specific capture");
570 eprintln!(" cargo run -- --all / -a parse all captures in ./captures");
571 std::process::exit(1);
572 }
573 }
574}

Callers

nothing calls this directly

Calls 1

write_parsedFunction · 0.85

Tested by

no test coverage detected