From e8abcefde62fc59e989c21545f5b44f5588cc43d Mon Sep 17 00:00:00 2001 From: smicallef Date: Sun, 15 Aug 2021 20:56:42 +0200 Subject: [PATCH] Log console output even if json output is selected, and verify the output format chosen. --- sf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sf.py b/sf.py index 71b9353d37..629dc67c9e 100755 --- a/sf.py +++ b/sf.py @@ -147,7 +147,7 @@ def main(): log.setLevel(logging.INFO) sfConfig['_debug'] = False - if args.q or args.o == "json": + if args.q: log.setLevel(logging.NOTSET) sfConfig['__logging'] = False @@ -341,6 +341,9 @@ def start_scan(sfConfig, sfModules, args): sfp__stor_stdout_opts['_requested'] = args.F.split(",") sfp__stor_stdout_opts['_showonlyrequested'] = True if args.o: + if args.o not in ["tab", "csv", "json"]: + log.error("Invalid output format selected. Must be 'tab', 'csv' or 'json'.") + sys.exit(-1) sfp__stor_stdout_opts['_format'] = args.o if args.t: sfp__stor_stdout_opts['_requested'] = args.t.split(",")