(binary: &str, pid: &str, ancestors: &str)
| 54 | /// Parses an ancestors string like "bash -> node" into a parent chain. |
| 55 | #[must_use] |
| 56 | pub fn from_bypass(binary: &str, pid: &str, ancestors: &str) -> Self { |
| 57 | let pid = pid.parse::<i64>().unwrap_or(0); |
| 58 | let mut proc = Self::new(binary, pid); |
| 59 | |
| 60 | // Parse ancestor chain "grandparent -> parent" into nested parent_process |
| 61 | let parts: Vec<&str> = ancestors.split(" -> ").collect(); |
| 62 | if parts.len() >= 2 { |
| 63 | let mut parent = Self::new(parts[parts.len() - 1], 0); |
| 64 | for ancestor in parts[..parts.len() - 1].iter().rev() { |
| 65 | parent = Self::new(ancestor, 0).with_parent(parent); |
| 66 | } |
| 67 | proc.parent_process = Some(Box::new(parent)); |
| 68 | } else if !ancestors.is_empty() && ancestors != binary { |
| 69 | proc.parent_process = Some(Box::new(Self::new(ancestors, 0))); |
| 70 | } |
| 71 | |
| 72 | proc |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /// OCSF Actor object — the entity that initiated the event. |
nothing calls this directly
no test coverage detected