logger = logging.getLogger(__name__)
def parse_log():
- output = ''
logger.debug("Starting smbd section")
- output += opentag('div', 1, 'smbd', 'section')
+ section = Section("smbd")
files = glob.glob(config.prefs['logs']['smb'] + "/log.*[!\.gz][!\.old]") # find list of logfiles
# for f in files:
# else:
# sigma_auths[exists[0]][1] += 1
n_auths += 1
- output += writetitle("samba")
- subtitle = plural("login", n_auths) + " from"
+ auth_data = Data(subtitle=plural("login", n_auths) + " from")
if (len(sigma_auths) == 1): # if only one user, do not display no of logins for this user
- subtitle += ' ' + sigma_auths[0][0]
- output += writedata(subtitle)
+ auth_data.subtitle += ' ' + sigma_auths[0][0]
+ section.append_data(auth_data)
else: # multiple users
- sigma_auths = orderbyfreq(sigma_auths)
- sigma_auths = truncl(sigma_auths, config.prefs['maxlist'])
+ auth_data.items = sigma_auths
+ auth_data.orderbyfreq()
+ auth_data.truncl(config.prefs['maxlist'])
logger.debug("Found {0} samba logins".format(str(n_auths)))
- output += writedata(subtitle, sigma_auths)
- output += closetag('div', 1)
+ section.append_data(auth_data)
logger.info("Finished smbd section")
- return output
+ return section