Discard empty subtrees induced by sshd

This commit is contained in:
Gerard Wagener 2010-01-21 10:46:58 +01:00
parent 85d792e0fb
commit 0171dd64d5

View file

@ -230,6 +230,12 @@ class ProcessTrees:
# f is file object # f is file object
# pid is the root process # pid is the root process
def desc_root_process(self,f,pid): def desc_root_process(self,f,pid):
vec = self.recover_process_vector(pid)
#Sometimes SSHD clones processes that are not related
#to users, small trees about a length of 2
if (len(vec) == 0):
return
f.write("** user root process %d **\n"%pid) f.write("** user root process %d **\n"%pid)
sshinfo = self.search_ssh_info(pid) sshinfo = self.search_ssh_info(pid)
if sshinfo: if sshinfo:
@ -240,7 +246,6 @@ class ProcessTrees:
obj=datetime.datetime.fromtimestamp(float(ts)) obj=datetime.datetime.fromtimestamp(float(ts))
f.write("Connection date: %s\n"%str(obj)) f.write("Connection date: %s\n"%str(obj))
#Add process vector #Add process vector
vec = self.recover_process_vector(pid)
f.write("Process vector: %s\n"%','.join(vec)) f.write("Process vector: %s\n"%','.join(vec))
f.write('\n') f.write('\n')
def exportUserListTxt(self,filename): def exportUserListTxt(self,filename):