# -*- 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, FileReportMixin25from lib.utils.common import get_readable_size262728class PlainTextReport(FileReportMixin, BaseReport):29__format__ = "plain"30__extension__ = "txt"3132def new(self):33return f"# Dirsearch started at {START_TIME} as: {COMMAND}" + NEW_LINE3435@locked36def save(self, file, result):37readable_size = get_readable_size(result.length)38data = self.parse(file)39data += f"{result.status} {readable_size.rjust(6, chr(32))} {result.url}"4041if result.redirect:42data += f" -> {result.redirect}"4344data += NEW_LINE4546self.write(file, data)474849