MCPcopy Index your code
hub / github.com/NullArray/AutoSploit / check_services

Function check_services

lib/settings.py:221–239  ·  view source on GitHub ↗

check to see if certain services ar started

(service_name)

Source from the content-addressed store, hash-verified

219
220
221def check_services(service_name):
222 """
223 check to see if certain services ar started
224 """
225 try:
226 all_processes = set()
227 for pid in psutil.pids():
228 running_proc = psutil.Process(pid)
229 all_processes.add(" ".join(running_proc.cmdline()).strip())
230 for proc in list(all_processes):
231 if service_name in proc:
232 return True
233 return False
234 except psutil.ZombieProcess as e:
235 # zombie processes appear to happen on macOS for some reason
236 # so we'll just kill them off
237 pid = str(e).split("=")[-1].split(")")[0]
238 os.kill(int(pid), 0)
239 return True
240
241
242def write_to_file(data_to_write, filename, mode=None):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected