added some creature comforts and cleaned logging

This commit is contained in:
Andrew Rioux 2023-12-05 15:16:20 -05:00
parent 0021794c51
commit 2f9746fa25
Signed by: andrew.rioux
GPG Key ID: 9B8BAC47C17ABB94
2 changed files with 3 additions and 13 deletions

View File

@ -331,7 +331,6 @@ async fn use_socket(conf: BeaconOptions, mut socket_handle: TcpSocketHandle) {
loop { loop {
let state = socket_handle.state_changed.recv().await; let state = socket_handle.state_changed.recv().await;
dbg!(&state);
match state { match state {
Some(TcpState::Established) => break, Some(TcpState::Established) => break,
_ => {} _ => {}
@ -383,7 +382,7 @@ async fn use_socket(conf: BeaconOptions, mut socket_handle: TcpSocketHandle) {
async fn main() -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> {
simple_logger::SimpleLogger::new() simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Info) .with_level(log::LevelFilter::Info)
.with_module_level("tcp_test", log::LevelFilter::Info) .with_module_level("sparse_c2_beacon", log::LevelFilter::Info)
.init()?; .init()?;
let conf_raw = catconf::read_from_exe(sparse_c2_messages::CONF_SEPARATOR, 4096)?; 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::<pcap_sys::DevDisabled>::new(&ifname)?; let mut interface = pcap_sys::Interface::<pcap_sys::DevDisabled>::new(&ifname)?;
let srcip = conf.source_ip; let srcip = conf.source_ip;
dbg!(srcip, src_mac, dst_mac);
// let dst_mac = [0x00, 0x16, 0x3e, 0xde, 0xa9, 0x93]; // let dst_mac = [0x00, 0x16, 0x3e, 0xde, 0xa9, 0x93];

View File

@ -138,7 +138,7 @@ async fn main() -> anyhow::Result<()> {
loop { loop {
let mut buffer = String::new(); let mut buffer = String::new();
match selected_beacon { match selected_beacon {
Some(ref bid) => print!("{} >", bid.0), Some(ref bid) => print!("{} > ", bid.0),
None => print!("> "), None => print!("> "),
}; };
stdout.flush()?; stdout.flush()?;
@ -156,15 +156,7 @@ async fn main() -> anyhow::Result<()> {
} }
Some("select") => { Some("select") => {
let beacon = items.next(); let beacon = items.next();
selected_beacon = beacon.map(ToOwned::to_owned).map(BeaconId);
match beacon {
Some(bid) => {
selected_beacon = Some(BeaconId(bid.to_owned()));
}
None => {
eprintln!("No beacon ID selected")
}
}
} }
Some("cmd") => { Some("cmd") => {
let parts = items.collect::<Vec<_>>(); let parts = items.collect::<Vec<_>>();