| 647 | handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8')) |
| 648 | |
| 649 | def generate_html_table(self, file_path): |
| 650 | table_html = '<table class="styled-table"><thead><tr>' |
| 651 | with open(file_path, 'r') as file: |
| 652 | reader = csv.reader(file) |
| 653 | headers = next(reader) |
| 654 | for header in headers: |
| 655 | table_html += f'<th>{header}</th>' |
| 656 | table_html += '</tr></thead><tbody>' |
| 657 | for row in reader: |
| 658 | table_html += '<tr>' |
| 659 | for cell in row: |
| 660 | cell_class = "green" if cell.strip() else "red" |
| 661 | table_html += f'<td class="{cell_class}">{cell}</td>' |
| 662 | table_html += '</tr>' |
| 663 | table_html += '</tbody></table>' |
| 664 | return table_html |
| 665 | |
| 666 | def generate_html_table_netkb(self, file_path): |
| 667 | table_html = '<table class="styled-table"><thead><tr>' |