SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Add export command to sfcli
Brendan Coles0e94aeeba666
diff --git a/sfcli.py b/sfcli.pyindex d9c95d06..5ff42aae 100755--- a/sfcli.py+++ b/sfcli.py@@ -676,6 +676,53 @@ class SpiderFootCli(cmd.Cmd):d = d.replace("</SFURL>", "").replace("<SFURL>","")self.send_output(d, line, titles=titles)+ # Export data from a scan.+ def do_export(self, line):+ """export <sid> [-t type] [-x] [-u]+ Export the scan data for scan ID <sid> as type [type].+ Valid types: csv, json (default: json)."""+ c = self.myparseline(line)++ if len(c[0]) < 1:+ self.edprint("Invalid syntax.")+ return++ if '-t' in c[0]:+ export_format = c[0][c[0].index("-t")+1]+ else:+ export_format = 'json'++ if not export_format in ['json', 'csv']:+ print("Invalid export format: %s" % export_format)+ return++ base_url = self.ownopts['cli.server_baseurl']+ post = { "ids": c[0][0] }++ if export_format == 'json':+ res = self.request(base_url + '/scanexportjsonmulti', post=post)++ if not res:+ self.dprint("No results.")+ return++ j = json.loads(res)++ if len(j) < 1:+ self.dprint("No results.")+ return++ print(json.dumps(j))++ elif export_format == 'csv':+ res = self.request(base_url + '/scaneventresultexportmulti', post=post)++ if not res:+ self.dprint("No results.")+ return++ print(res)+# Show logs.def do_logs(self, line):"""logs <sid> [-l count] [-w]