Skip to content

Commit

Permalink
recognise ssh session and daemon correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sean797 committed May 5, 2017
1 parent e39b4e4 commit 027d055
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tracer/resources/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def is_interpreted(self):

@property
def is_session(self):
return self.instances and self.instances[0].is_session
if re.search('ssh-.*-session', self.name):
return True
return self.instances and self.instances[0].is_session

@property
def type(self):
Expand Down
7 changes: 5 additions & 2 deletions tracer/resources/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def __nonzero__(self):
return bool(self._process)

def name(self):
# Special case for sshd, if its cmd contains the execuatable is must be the daemon
# else must be the session.
if self._attr("name") == 'sshd':
if not self._attr("cmdline")[0] == self._attr("exe"):
return 'ssh-{0}-session'.format(re.split(' |@|',self._attr("cmdline")[0])[1])
return self._attr("name")

def exe(self):
Expand Down Expand Up @@ -186,8 +191,6 @@ def is_interpreted(self):
def is_session(self):
if self.terminal() is not None:
return True
if re.search("sshd\:\ .*\ \[priv\]", str(self.cmdline())):
return True

@property
def real_name(self):
Expand Down

0 comments on commit 027d055

Please sign in to comment.