Skip to content

Commit

Permalink
add n packets
Browse files Browse the repository at this point in the history
  • Loading branch information
adgaultier committed Jan 10, 2025
1 parent 45ec516 commit 15f4331
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tamanoir-c2/src/dns_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

use anyhow::Error;
use chrono::{DateTime, Utc};
use chrono::Utc;
use log::{debug, error, info};
use tamanoir_common::ContinuationByte;
use tokio::{net::UdpSocket, sync::Mutex};
Expand Down Expand Up @@ -157,6 +157,7 @@ impl DnsProxy {
} else {
let current_session = current_sessions.get_mut(&s.ip).unwrap();
current_session.latest_packet = Utc::now();
current_session.n_packets += 1;
}
}
debug!("{:?} bytes received from {:?}", len, addr);
Expand Down
2 changes: 2 additions & 0 deletions tamanoir-c2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub struct Session {
pub rce_payload: Option<SessionRcePayload>,
pub first_packet: DateTime<Utc>,
pub latest_packet: DateTime<Utc>,
pub n_packets: usize,
}
impl Session {
pub fn new(sock_addr: SocketAddr) -> Option<Self> {
Expand All @@ -121,6 +122,7 @@ impl Session {
rce_payload: None,
first_packet: now_utc,
latest_packet: now_utc,
n_packets: 1,
}),
_ => None,
}
Expand Down

0 comments on commit 15f4331

Please sign in to comment.