def getProcessList(self): """getProcessList: Return the process list """ processList = [] uidUser = self.getUidOfCurrentUser() for pid in readProcesses(): if (uidUser == "0") or (uidUser == self.getUidOfProcess(pid)): processList.append(str(pid) + "\t" + str(readProcessCmdline(pid)[0])) return processList
def getProcessList(self): """getProcessList: Return the process list """ processList = [] uidUser = self.getUidOfCurrentUser() for pid in readProcesses(): if (uidUser == "0") or (uidUser == self.getUidOfProcess(pid)): processList.append( str(pid) + "\t" + str(readProcessCmdline(pid)[0])) return processList
def handle_event(self, event): """Handle external events like new process execution or child close""" if isinstance(event, NewProcessEvent): # Under Linux the new process phase first fork a new process with the same # command line of the starting process then changes its command line # Therefore here I skip the NewProcessEvent event and after I add a new # process during the ProcessExecution event status = None elif isinstance(event, ProcessExecution): status = _('Process execution') elif isinstance(event, ProcessExit): status = _('Process exit') elif isinstance(event, ProcessSignal): status = _('Process signal: %s') % event elif isinstance(event, ChildError): status = None print event else: status = _('Event: %s') % event if status: pid = event.process.pid if RUNNING_LINUX and isinstance(event, ProcessExecution): self.event_callback(pid, _('Command line'), ' '.join(readProcessCmdline(event.process.pid))) self.event_callback(pid, _('Current working directory'), readProcessLink(event.process.pid, 'cwd')) # If the process has a parent PID include it in the details if event.process.parent: self.event_callback(pid, _('Parent PID'), str(event.process.parent.pid)) # Add process details details = self._get_process_status_details(event.process.pid) if details.has_key(UID): self.event_callback(pid, _('User ID'), details[UID].pw_uid) self.event_callback(pid, _('User name'), details[UID].pw_name) self.event_callback(pid, _('User real name'), details[UID].pw_gecos) if details.has_key(EUID): self.event_callback(pid, _('Effective user ID'), details[EUID].pw_uid) self.event_callback(pid, _('Effective user name'), details[EUID].pw_name) self.event_callback(pid, _('Effective user real name'), details[EUID].pw_gecos) if details.has_key(GID): self.event_callback(pid, _('Group ID'), details[GID].gr_gid) self.event_callback(pid, _('Group name'), details[GID].gr_name) if details.has_key(EGID): self.event_callback(pid, _('Effective group ID'), details[EGID].gr_gid) self.event_callback(pid, _('Effective group name'), details[EGID].gr_name) self.event_callback(pid, information=_('Status'), value=status)
def updateProcessList_cb(self, button): self.processStore.handler_block(self.handlerID) self.processStore.get_model().clear() for pid in readProcesses(): self.processStore.append_text(str(pid) + "\t" + readProcessCmdline(pid)[0]) self.processStore.handler_unblock(self.handlerID)