MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / format_malfind_csv

Function format_malfind_csv

src/os/linux/csv_export.cpp:127–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125ByteBuf format_udp_csv(const Engine& eng) { return format_socket_csv(eng, SocketInfo::P_UDP, "UDP"); }
126
127ByteBuf 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
154ByteBuf format_findevil_csv(const Engine& eng) {
155 // Single-row CSV: per-check counts. Wide schema for SIEM ingest —

Callers 1

build_sys_treeFunction · 0.85

Calls 2

find_malfindFunction · 0.85
csv_quoteFunction · 0.85

Tested by

no test coverage detected