Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

sf: Fix JSON output formatting when running sf from command line

bcoles129db51540f9
diff --git a/sf.py b/sf.py
index 91240405..7de82db2 100755
--- a/sf.py
+++ b/sf.py
@@ -339,6 +339,9 @@ if __name__ == '__main__':
if args.x and args.t:
cfg['__outputfilter'] = args.t.split(",")
+ if args.o == "json":
+ print("[", end='')
+
# Start running a new scan
scanName = target
scanId = sf.genScanInstanceGUID()
@@ -372,9 +375,6 @@ if __name__ == '__main__':
else:
print('{0:30}{1}{2:45}{3}{4}{5}{6}'.format("Source", delim, "Type", delim, "Source Data", delim, "Data"))
- if args.o == "json":
- print("[", end='')
-
while True:
info = dbh.scanInstanceGet(scanId)
if not info: