ip = entry.group(2)
userhost = user + '@' + resolve(ip, fqdn=config.prefs['sshd']['resolve-domains'])
- exists = [i for i, item in enumerate(users) if re.search(userhost, item[0])]
- if (exists == []):
- users.append([userhost, 1])
- else:
- users[exists[0]][1] += 1
+ users.append(userhost)
logger.debug("Parsed list of authorised users")
- auth_data = Data(subtitle=plural('login', num) + ' from')
-
- if (len(users) == 1): # if only one user, do not display no of logins for this user
- logger.debug("found " + str(len(matches)) + " ssh logins for user " + users[0][0])
- auth_data.subtitle += ' ' + users[0][0]
- else:
- for user in users:
- auth_data.items.append(user[0] + ' (' + str(user[1]) + ')')
- auth_data.orderbyfreq()
- auth_data.truncl(config.prefs['maxlist'])
- logger.debug("found " + str(len(matches)) + " ssh logins for users " + str(data))
+ auth_data = Data(subtitle=plural('login', num) + ' from', items=users)
+
+ if (len(auth_data.items) == 1): # if only one user, do not display no of logins for this user
+ logger.debug("found " + str(len(matches)) + " ssh logins for user " + users[0])
+ auth_data.subtitle += ' ' + auth_data.items[0]
+ auth_data.orderbyfreq()
+ auth_data.truncl(config.prefs['maxlist'])
+ logger.debug("Found " + str(len(matches)) + " ssh logins for users " + str(data))
section.append_data(auth_data)
logger.info("Finished sshd section")
return section