# -*- coding: utf-8 -*-1# This program is free software; you can redistribute it and/or modify2# it under the terms of the GNU General Public License as published by3# the Free Software Foundation; either version 2 of the License, or4# (at your option) any later version.5#6# This program is distributed in the hope that it will be useful,7# but WITHOUT ANY WARRANTY; without even the implied warranty of8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9# GNU General Public License for more details.10#11# You should have received a copy of the GNU General Public License12# along with this program; if not, write to the Free Software13# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,14# MA 02110-1301, USA.15#16# Author: Mauro Soria1718from lib.core.decorators import locked19from lib.core.settings import (20COMMAND,21NEW_LINE,22START_TIME,23)24from lib.report.factory import BaseReport, FileReportMixin252627class MarkdownReport(FileReportMixin, BaseReport):28__format__ = "markdown"29__extension__ = "md"3031def new(self):32header = "### Information" + NEW_LINE33header += f"Command: {COMMAND}"34header += NEW_LINE35header += f"Time: {START_TIME}"36header += NEW_LINE * 237header += "URL | Status | Size | Content Type | Redirection" + NEW_LINE38header += "----|--------|------|--------------|------------" + NEW_LINE39return header4041@locked42def save(self, file, result):43md = self.parse(file)44md += f"{result.url} | {result.status} | {result.length} | {result.type} | {result.redirect}" + NEW_LINE45self.write(file, md)464748