Skip to content

Commit

Permalink
Merge pull request maurosoria#761 from wdahlenburg/reporting
Browse files Browse the repository at this point in the history
Include cmdline args in reports
  • Loading branch information
maurosoria authored Apr 7, 2021
2 parents d856319 + e74b986 commit 4b9e5f1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/reports/json_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import json
import time
import sys

from lib.reports import *

Expand All @@ -35,7 +36,10 @@ def generate(self):
headerName = "{0}://{1}:{2}/{3}".format(
self.protocol, self.host, self.port, self.basePath
)
result = {"time": time.ctime(), headerName: []}

info = {"args": ' '.join(sys.argv), "time": time.ctime()}

result = {"info": info, headerName: []}

for path, status, contentLength, redirect in self.pathList:
entry = {
Expand Down
4 changes: 3 additions & 1 deletion lib/reports/markdown_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from lib.reports import *
import time
import sys


class MarkdownReport(FileBaseReport):
Expand All @@ -35,7 +36,8 @@ def generate(self):
self.protocol, self.host, self.port, self.basePath
)

result = "### Time: {0}\n".format(time.ctime())
result = "### Args: {0}\n".format(' '.join(sys.argv))
result += "### Time: {0}\n".format(time.ctime())
result += "### Target: {0}\n\n".format(headerName)
result += "Path | Status | Size | Redirection\n"
result += "-----|--------|------|------------\n"
Expand Down
3 changes: 2 additions & 1 deletion lib/reports/plain_text_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from lib.utils.file_utils import FileUtils

import time
import sys


class PlainTextReport(FileBaseReport):
Expand All @@ -37,7 +38,7 @@ def addPath(self, path, status, response):
self.storeData((path, status, contentLength, location))

def generate(self):
result = "Time: {0}\n\n".format(time.ctime())
result = "# Dirsearch started {0} as: {1}\n\n".format(time.ctime(), ' '.join(sys.argv))

for path, status, contentLength, location in self.pathList:
result += "{0} ".format(status)
Expand Down
4 changes: 3 additions & 1 deletion lib/reports/xml_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from lib.reports import *
import time
import sys


class XMLReport(FileBaseReport):
Expand All @@ -37,7 +38,7 @@ def generate(self):
self.protocol, self.host, self.port, self.basePath
)

result += "<time>{0}</time>\n".format(time.ctime())
result += "<dirsearchScan args=\"{0}\" time=\"{1}\">\n".format(' '.join(sys.argv), time.ctime())
result += "<target url=\"{0}\">\n".format(headerName)

for path, status, contentLength, redirect in self.pathList:
Expand All @@ -48,5 +49,6 @@ def generate(self):
result += " </info>\n"

result += "</target>\n"
result += "</dirsearchScan>\n"

return result

0 comments on commit 4b9e5f1

Please sign in to comment.