Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options to disable all the CLI output #1408

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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]
## Support: plain, simple, 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 @@ -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"
)
Expand Down
3 changes: 3 additions & 0 deletions lib/parse/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 9 additions & 1 deletion lib/view/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading