SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Fixed CSV parsing error.
Mario Vilasf7770c3edca4
diff --git a/sfwebui.py b/sfwebui.pyindex 30d08378..232bdc79 100644--- a/sfwebui.py+++ b/sfwebui.py@@ -12,6 +12,7 @@ import jsonimport threadingimport cherrypyimport cgi+import csvimport osimport timeimport urllib2@@ -21,6 +22,7 @@ from mako.template import Templatefrom sfdb import SpiderFootDbfrom sflib import SpiderFootfrom sfscan import SpiderFootScanner+from StringIO import StringIOclass SpiderFootWebUi:lookup = TemplateLookup(directories=[''])@@ -51,22 +53,21 @@ class SpiderFootWebUi:## Get result data in CSV format- def scaneventresultexport(self, id, type):+ def scaneventresultexport(self, id, type, dialect="excel"):dbh = SpiderFootDb(self.config)data = dbh.scanResultEvent(id, type)- blob = "\"Updated\",\"Type\",\"Module\",\"Source\",\"Data\"\n"+ fileobj = StringIO()+ parser = csv.writer(fileobj, dialect=dialect)+ parser.writerow(["Updated", "Type", "Module", "Source", "Data"])for row in data:lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))- escapedData = cgi.escape(row[1].replace("\n", "#LB#").replace("\r", "#LB#"))- escapedSrc = cgi.escape(row[2].replace("\n", "#LB#").replace("\r", "#LB#"))- blob = blob + "\"" + lastseen + "\",\"" + row[4] + "\",\""- blob = blob + row[3] + "\",\"" + escapedSrc + "\",\"" + escapedData + "\"\n"+ parser.writerow([lastseen, str(row[4]), str(row[3]), str(row[2]), str(row[1])])cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"cherrypy.response.headers['Content-Type'] = "application/csv"cherrypy.response.headers['Pragma'] = "no-cache"- return blob+ return fileobj.getvalue()scaneventresultexport.exposed = True-+# Configuration used for a scandef scanopts(self, id):ret = dict()