Skip to content

Commit

Permalink
Address PR feedback - add ATT&CK mapping, change associated_pids to V…
Browse files Browse the repository at this point in the history
…ec<u32>, remove itertools
  • Loading branch information
maclarel committed Dec 19, 2024
1 parent dbffa73 commit 3671ba2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion Payload_Type/thanatos/thanatos/agent_code/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ rand = "0.8"
serde_json = "1.0"
sha2 = "0.9.8"
netstat2 = "0.9.1"
itertools = "0.13.0"

[dependencies.minreq]
version = "2.4.2"
Expand Down
7 changes: 3 additions & 4 deletions Payload_Type/thanatos/thanatos/agent_code/src/netstat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde::Serialize;
use itertools::Itertools;
use crate::agent::AgentTask;
use crate::mythic_success;
use netstat2::{get_sockets_info, AddressFamilyFlags, ProtocolFlags, ProtocolSocketInfo};
Expand All @@ -23,7 +22,7 @@ pub struct NetworkListingEntry {
pub remote_port: Option<u16>,

/// Associated PIDs
pub associated_pids: String,
pub associated_pids: Vec<u32>,

/// State
pub state: Option<String>,
Expand All @@ -44,7 +43,7 @@ pub fn netstat(task: &AgentTask) -> Result<(serde_json::Value), Box<dyn std::err
local_port: tcp_si.local_port,
remote_addr: Some(tcp_si.remote_addr.to_string()),
remote_port: Some(tcp_si.remote_port),
associated_pids: Itertools::join(&mut si.associated_pids.iter(), ","),
associated_pids: si.associated_pids,
state: Some(tcp_si.state.to_string()),
}),
ProtocolSocketInfo::Udp(udp_si) => conn.push(NetworkListingEntry {
Expand All @@ -53,7 +52,7 @@ pub fn netstat(task: &AgentTask) -> Result<(serde_json::Value), Box<dyn std::err
local_port: udp_si.local_port,
remote_addr: None,
remote_port: None,
associated_pids: Itertools::join(&mut si.associated_pids.iter(), ","),
associated_pids: si.associated_pids,
state: None,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NetstatCommand(CommandBase):
version = 1
author = "@maclarel"
argument_class = NetstatArguments
attackmapping = [""]
attackmapping = ["T1049"]
attributes = CommandAttributes(
supported_os=[SupportedOS.Linux, SupportedOS.Windows],
)
Expand Down

0 comments on commit 3671ba2

Please sign in to comment.