diff --git a/etc/mesh_bot_w3.tmp b/etc/mesh_bot_reporting.tmp similarity index 100% rename from etc/mesh_bot_w3.tmp rename to etc/mesh_bot_reporting.tmp diff --git a/etc/report_generator.py b/etc/report_generator.py index d80010d..0164d69 100644 --- a/etc/report_generator.py +++ b/etc/report_generator.py @@ -15,6 +15,7 @@ from collections import Counter, defaultdict LOG_PATH = '/opt/meshing-around/logs' W3_PATH = '/var/www/html' multiLogReader = False +shameWordList = ['password', 'combo', 'key', 'hidden', 'secret', 'pass', 'token', 'login', 'username', 'admin', 'root'] def parse_log_file(file_path): global log_data @@ -57,7 +58,8 @@ def parse_log_file(file_path): 'node1_name': "N/A", 'node2_name': "N/A", 'node1_ID': "N/A", - 'node2_ID': "N/A" + 'node2_ID': "N/A", + 'shameList': [] } for line in lines: @@ -82,6 +84,11 @@ def parse_log_file(file_path): log_data['message_types']['Incoming DM'] += 1 log_data['total_messages'] += 1 log_data['message_timestamps'].append((timestamp.isoformat(), 'Incoming DM')) + # check for shame words in the message + for word in shameWordList: + if word in line.lower(): + if line not in log_data['shameList']: + log_data['shameList'].append(line) user_match = re.search(r'From: (\w+)', line) if user_match: @@ -231,10 +238,15 @@ def get_system_info(): } def get_wall_of_shame(): - # Get the wall of shame + # Get the wall of shame out of the log data + logShameList = log_data['shameList'] + print(f"Shame List: {logShameList}") + + # future space for other ideas return { - 'shame': "N/A", + 'shame': ', '.join(shameWordList), + 'shameList': '\n'.join(f'
| Shame Metric | Value |
|---|---|
| shame | ${shame} |
| Shamefull words | ${shame} |
| Shamefull messages | ${shameList} |