diff --git a/CHANGELOG.md b/CHANGELOG.md index 4677bafa5..229033326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Remove unused dependencies (urllib3, cryptography, cffi, idna, chardet) - Load targets from a Nmap XML report - Added --async option to enable asynchronous mode (use coroutines instead of threads) +- Added option to disable CLI output entirely ## [0.4.3] - October 2nd, 2022 - Automatically detect the URI scheme (`http` or `https`) if no scheme is provided diff --git a/config.ini b/config.ini index 7a005a2ae..65b5fcacd 100644 --- a/config.ini +++ b/config.ini @@ -70,6 +70,7 @@ full-url = False quiet-mode = False color = True show-redirects-history = False +disable-cli = False [output] ## Support: plain, simple, json, xml, md, csv, html, sqlite, mysql, postgresql diff --git a/lib/core/data.py b/lib/core/data.py index 9eff02734..c87339efd 100755 --- a/lib/core/data.py +++ b/lib/core/data.py @@ -88,6 +88,7 @@ "redirects_history": False, "color": True, "quiet": False, + "disable_cli": False, "output_file": None, "output_format": None, "log_file": None, diff --git a/lib/core/options.py b/lib/core/options.py index 8bcdce5be..7d88bb87e 100755 --- a/lib/core/options.py +++ b/lib/core/options.py @@ -359,6 +359,7 @@ def parse_config(opt): opt.full_url = opt.full_url or config.safe_getboolean("view", "full-url") opt.color = opt.color if opt.color is False else config.safe_getboolean("view", "color", True) opt.quiet = opt.quiet or config.safe_getboolean("view", "quiet-mode") + opt.disable_cli = opt.disable_cli or config.safe_getboolean("view", "disable-cli") opt.redirects_history = opt.redirects_history or config.safe_getboolean( "view", "show-redirects-history" ) diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index a63554a54..f6892ee94 100755 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -494,6 +494,9 @@ def parse_arguments(): view.add_option( "-q", "--quiet-mode", action="store_true", dest="quiet", help="Quiet mode" ) + view.add_option( + "--disable-cli", action="store_true", dest="disable_cli", help="Turn off command-line output" + ) # Output Settings output = OptionGroup(parser, "Output Settings") diff --git a/lib/view/terminal.py b/lib/view/terminal.py index d85b0fb51..198653f22 100755 --- a/lib/view/terminal.py +++ b/lib/view/terminal.py @@ -233,4 +233,12 @@ def log_file(*args): pass -interface = QuietCLI() if options["quiet"] else CLI() +class EmptyCLI(QuietCLI): + def status_report(*args): + pass + + def error(*args): + pass + + +interface = EmptyCLI() if options["disable_cli"] else QuietCLI() if options["quiet"] else CLI()