aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorWill Dillon <william@housedillon.com>2025-11-07 23:19:11 +0000
committerWill Dillon <william@housedillon.com>2025-11-07 23:19:11 +0000
commit5fc50c5f6e3295c5480e4f576fe2415e0c3fc96d (patch)
tree01ed06fb46efa750eb27d894fef43ca1dab8ac63 /src/bin
parentSwitching to Mac (diff)
downloadmeshcore-rs-5fc50c5f6e3295c5480e4f576fe2415e0c3fc96d.tar.gz
meshcore-rs-5fc50c5f6e3295c5480e4f576fe2415e0c3fc96d.zip
Back over to the laptop
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/packet_analyzer.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/bin/packet_analyzer.rs b/src/bin/packet_analyzer.rs
new file mode 100644
index 0000000..ee3c3fe
--- /dev/null
+++ b/src/bin/packet_analyzer.rs
@@ -0,0 +1,36 @@
+use std::path::PathBuf;
+use tokio::fs::File;
+
+use clap::Parser;
+use color_eyre::eyre::Result;
+use meshcore::{crypto::Keychain, identity::KeystoreInput};
+use pretty_env_logger;
+use pcap_file_tokio::pcapng::{Block::*, PcapNgReader, PcapNgWriter, blocks::interface_description::InterfaceDescriptionBlock};
+
+#[derive(Parser)]
+struct AnalyzerArguments {
+ #[arg(long, short, help = "Identities file for packet decryption")]
+ identities_file: PathBuf,
+
+ #[arg(long, short, help = "Pcapng file to input packets for analysis")]
+ pcap_file: PathBuf,
+}
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ pretty_env_logger::init();
+
+ let args = AnalyzerArguments::parse();
+
+ // Attempt to load the identities file from disk and load all the identities
+ let identity_string = std::fs::read_to_string(args.identities_file)?;
+ let keystore_in: KeystoreInput = toml::from_str(&identity_string)?;
+ let keystore = keystore_in.compile();
+
+ // Pcapng file for loading packets
+ let pcap_file = File::open(args.pcap_file).await?;
+ let pcap_reader = PcapNgReader::new(pcap_file).await?;
+
+
+ Ok(())
+} \ No newline at end of file