Finally got secondary scan covering all log entries

This commit is contained in:
Brian Read 2024-06-03 20:44:16 +01:00
parent 5db9ddf82f
commit c647574cb0

View File

@ -586,27 +586,31 @@ if __name__ == "__main__":
total_countries = 0 total_countries = 0
DMARCOkCount = 0 DMARCOkCount = 0
# Pick up all log_entries = read_yesterday_log_file(data_file) # Pick up all log_entries = read_yesterday_log_file(data_file)
sorted_log_dict = sort_log_entries(log_entries) #sorted_log_dict = sort_log_entries(log_entries)
i = 0 i = 0
sorted_len = len(sorted_log_dict) j = 0
print_progress_bar(0, sorted_len, prefix='Progress:', suffix='Complete', length=50) log_len = len(log_entries)
for timestamp, data in sorted_log_dict.items(): print_progress_bar(0, log_len, prefix='Progress:', suffix='Complete', length=50)
for data in log_entries:
i += 1 i += 1
print_progress_bar(i, sorted_len, prefix='Scanning for sub tables:', suffix='Complete', length=50) print_progress_bar(i, log_len, prefix='Scanning for sub tables:', suffix='Complete', length=50)
#Pull out Geoip countries for analysis table #Pull out Geoip countries for analysis table
match = geoip_pattern.match(data) if "check_badcountries: GeoIP Country" in data:
j += 1
match = geoip_pattern.match(data[1])
if match: if match:
country = match.group(1) country = match.group(1)
found_countries[country] += 1 found_countries[country] += 1
total_countries += 1 total_countries += 1
continue continue
#Pull out DMARC approvals #Pull out DMARC approvals
match = dmarc_pattern.match(data) match = dmarc_pattern.match(data[1])
if match: if match:
DMARCOkCount += 1 DMARCOkCount += 1
continue continue
print(f"J:{j} I:{i}")
#Now apply the results to the chameleon template - main table #Now apply the results to the chameleon template - main table
# Path to the template file # Path to the template file
template_path = data_file_path+'mailstats.html.pt' template_path = data_file_path+'mailstats.html.pt'