def run(self, session: CbLRSessionBase): from cbinterface.helpers import get_os_independent_filepath for process in session.list_processes(): filepath = get_os_independent_filepath(process["path"]) if self.pname.lower() in filepath.name.lower(): LOGGER.info(f"found process to kill: {process['path']} - pid={process['pid']}") self.nested_commands[process["pid"]] = session.kill_process(process["pid"]) return True
def run(self, session: CbLRSessionBase): from cbinterface.helpers import get_os_independent_filepath from cbinterface.response.sessions import CustomLiveResponseSessionManager self.local_session_manager = CustomLiveResponseSessionManager(session._cb) for process in session.list_processes(): filepath = get_os_independent_filepath(process["path"]) if self.pname in filepath.name: LOGGER.info(f"found process to kill: {process['path']} - pid={process['pid']}") cmd = KillProcessByID(process["pid"]) self.local_session_manager.submit_command(cmd, self.sensor_id) return True
def run(self, session: CbLRSessionBase): return session.list_processes()