Skip to content

Commit

Permalink
Merge pull request #1408 from maurosoria/no-cli
Browse files Browse the repository at this point in the history
Options to disable all the CLI output
  • Loading branch information
maurosoria authored Oct 16, 2024
2 parents 5b1ddb4 + f102496 commit 419cbef
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Support non-default network interface
- 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
Expand Down
1 change: 1 addition & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ full-url = False
quiet-mode = False
color = True
show-redirects-history = False
disable-cli = False

[output]
# Available: simple, plain, json, xml, md, csv, html, sqlite, mysql, postgresql
Expand Down
1 change: 1 addition & 0 deletions lib/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"redirects_history": False,
"color": True,
"quiet": False,
"disable_cli": False,
"output_file": None,
"output_format": None,
"log_file": None,
Expand Down
1 change: 1 addition & 0 deletions lib/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def merge_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"
)
Expand Down
3 changes: 3 additions & 0 deletions lib/parse/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,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")
Expand Down
10 changes: 9 additions & 1 deletion lib/view/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,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()

0 comments on commit 419cbef

Please sign in to comment.