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

Function shell_like_process

src/os/linux/bash_history.cpp:145–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool shell_like_process(const Engine& eng, const Process& p) {
146 if (p.mm == 0) return false;
147 if (p.comm == "bash" || p.comm == "zsh" || p.comm == "fish" ||
148 p.comm == "sh" || p.comm == "dash" || p.comm == "ksh" ||
149 p.comm == "mksh") return true;
150 std::string meta;
151 try {
152 auto cmd = gen_cmdline(eng.phys(), eng.isf(), eng.kernel(), p);
153 meta.append(reinterpret_cast<const char*>(cmd.data()), cmd.size());
154 } catch (...) {}
155 try {
156 auto env = gen_environ(eng.phys(), eng.isf(), eng.kernel(), p);
157 meta.append(reinterpret_cast<const char*>(env.data()), env.size());
158 } catch (...) {}
159 return meta.find("SHELL=") != std::string::npos ||
160 meta.find("HISTFILE=") != std::string::npos ||
161 meta.find("ZDOTDIR=") != std::string::npos ||
162 contains_icase(meta, "bash") ||
163 contains_icase(meta, "zsh") ||
164 contains_icase(meta, "fish");
165}
166
167bool generic_heap_scan_allowed(const Engine& eng, const Process& p) {
168 if (p.comm == "bash" || p.comm == "zsh" || p.comm == "fish" ||

Callers 1

scan_shell_historyFunction · 0.85

Calls 5

gen_cmdlineFunction · 0.85
gen_environFunction · 0.85
contains_icaseFunction · 0.85
sizeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected