| 125 | ByteBuf format_udp_csv(const Engine& eng) { return format_socket_csv(eng, SocketInfo::P_UDP, "UDP"); } |
| 126 | |
| 127 | ByteBuf format_malfind_csv(const Engine& eng) { |
| 128 | std::string out; |
| 129 | out.reserve(16 * 1024); |
| 130 | out += "pid,comm,vm_start,vm_end,size,perms,severity,reason\r\n"; |
| 131 | for (const auto& p : eng.processes()) { |
| 132 | std::vector<MalfindHit> hits; |
| 133 | try { hits = find_malfind(eng, p); } catch (...) { continue; } |
| 134 | for (const auto& h : hits) { |
| 135 | char perm[4] = { |
| 136 | (h.vm_flags & 1) ? 'r' : '-', |
| 137 | (h.vm_flags & 2) ? 'w' : '-', |
| 138 | (h.vm_flags & 4) ? 'x' : '-', |
| 139 | 0 |
| 140 | }; |
| 141 | out += fmt::format("{},{},{:#x},{:#x},{},{},{},{}\r\n", |
| 142 | p.pid, |
| 143 | csv_quote(p.comm), |
| 144 | h.vm_start, h.vm_end, |
| 145 | h.vm_end - h.vm_start, |
| 146 | perm, |
| 147 | h.high_severity ? "HIGH" : "INFO", |
| 148 | csv_quote(h.reason)); |
| 149 | } |
| 150 | } |
| 151 | return ByteBuf(out.begin(), out.end()); |
| 152 | } |
| 153 | |
| 154 | ByteBuf format_findevil_csv(const Engine& eng) { |
| 155 | // Single-row CSV: per-check counts. Wide schema for SIEM ingest — |
no test coverage detected