MCPcopy Create free account
hub / github.com/HexHive/NASS / do_invoke

Method do_invoke

tools/gef.py:6850–6878  ·  view source on GitHub ↗
(self, _: List, **kwargs: Any)

Source from the content-addressed store, hash-verified

6848
6849 @parse_arguments({"pattern": ""}, {"--attach": True, "--smart-scan": True})
6850 def do_invoke(self, _: List, **kwargs: Any) -> None:
6851 args : argparse.Namespace = kwargs["arguments"]
6852 do_attach = args.attach
6853 smart_scan = args.smart_scan
6854 pattern = args.pattern
6855 pattern = re.compile("^.*$") if not args else re.compile(pattern)
6856
6857 for process in self.get_processes():
6858 pid = int(process["pid"])
6859 command = process["command"]
6860
6861 if not re.search(pattern, command):
6862 continue
6863
6864 if smart_scan:
6865 if command.startswith("[") and command.endswith("]"): continue
6866 if command.startswith("socat "): continue
6867 if command.startswith("grep "): continue
6868 if command.startswith("gdb "): continue
6869
6870 if args and do_attach:
6871 ok(f"Attaching to process='{process['command']}' pid={pid:d}")
6872 gdb.execute(f"attach {pid:d}")
6873 return None
6874
6875 line = [process[i] for i in ("pid", "user", "cpu", "mem", "tty", "command")]
6876 gef_print("\t\t".join(line))
6877
6878 return None
6879
6880 def get_processes(self) -> Generator[Dict[str, str], None, None]:
6881 output = gef_execute_external(self["ps_command"].split(), True)

Callers

nothing calls this directly

Calls 5

get_processesMethod · 0.95
gef_printFunction · 0.85
searchMethod · 0.80
joinMethod · 0.80
okFunction · 0.70

Tested by

no test coverage detected