From ff51c36a881a40eb88500e5b00b9b28179e72afa Mon Sep 17 00:00:00 2001 From: 4shen0ne <4shen.01@gmail.com> Date: Fri, 13 Sep 2024 22:32:27 +0800 Subject: [PATCH 1/3] add --silent option --- README.md | 2 ++ config.ini | 1 + lib/core/data.py | 1 + lib/core/options.py | 1 + lib/parse/cmdline.py | 3 +++ lib/view/terminal.py | 7 ++++++- 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c8d3b4a74..870ea81df 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,7 @@ Options: Show redirects history --no-color No colored output -q, --quiet-mode Quiet mode + --silent Silent mode Output Settings: -o PATH, --output=PATH @@ -343,6 +344,7 @@ crawl = False [view] full-url = False quiet-mode = False +silent = Faise color = True show-redirects-history = False diff --git a/config.ini b/config.ini index 21b4413a6..ed116a8ad 100644 --- a/config.ini +++ b/config.ini @@ -67,6 +67,7 @@ crawl = False [view] full-url = False quiet-mode = False +silent = False color = True show-redirects-history = False diff --git a/lib/core/data.py b/lib/core/data.py index 46292f4d4..59f066ab7 100755 --- a/lib/core/data.py +++ b/lib/core/data.py @@ -87,6 +87,7 @@ "redirects_history": False, "color": True, "quiet": False, + "silent": False, "output_file": None, "output_format": None, "log_file": None, diff --git a/lib/core/options.py b/lib/core/options.py index 03119700d..57d341482 100755 --- a/lib/core/options.py +++ b/lib/core/options.py @@ -355,6 +355,7 @@ def parse_config(opt): opt.full_url = opt.full_url or config.safe_getboolean("view", "full-url") opt.color = opt.color or config.safe_getboolean("view", "color", True) opt.quiet = opt.quiet or config.safe_getboolean("view", "quiet-mode") + opt.silent = opt.silent or config.safe_getboolean("view", "silent") 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 fb71e9860..38411b467 100755 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -489,6 +489,9 @@ def parse_arguments(): view.add_option( "-q", "--quiet-mode", action="store_true", dest="quiet", help="Quiet mode" ) + view.add_option( + "--silent", action="store_true", dest="silent", help="Silent mode" + ) # Output Settings output = OptionGroup(parser, "Output Settings") diff --git a/lib/view/terminal.py b/lib/view/terminal.py index d85b0fb51..a4acaed9e 100755 --- a/lib/view/terminal.py +++ b/lib/view/terminal.py @@ -233,4 +233,9 @@ def log_file(*args): pass -interface = QuietCLI() if options["quiet"] else CLI() +class SilentCLI(QuietCLI): + def status_report(self, response, _): + self.new_line(response.url) + + +interface = SilentCLI() if options["silent"] else QuietCLI() if options["quiet"] else CLI() From 0233cb6e60111c87e3dd04e2e3133d3767b5bd2b Mon Sep 17 00:00:00 2001 From: 4shen0ne <4shen.01@gmail.com> Date: Fri, 13 Sep 2024 22:47:27 +0800 Subject: [PATCH 2/3] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9460881a..2d38cbe04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Support non-default network interface - Remove unused dependencies (urllib3, cryptography, cffi, idna, chardet) - Load targets from a Nmap XML report +- Added --silent option to output only the full URL ## [0.4.3] - October 2nd, 2022 - Automatically detect the URI scheme (`http` or `https`) if no scheme is provided From 73ba63fb20ee6fea38e25f3e492241c8f5cc1d6e Mon Sep 17 00:00:00 2001 From: 4shen0ne <4shen.01@gmail.com> Date: Thu, 19 Sep 2024 11:25:38 +0800 Subject: [PATCH 3/3] rename --silent to --urls-only --- CHANGELOG.md | 2 +- README.md | 4 ++-- config.ini | 2 +- lib/core/data.py | 2 +- lib/core/options.py | 2 +- lib/parse/cmdline.py | 2 +- lib/view/terminal.py | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d38cbe04..bfe89cac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Support non-default network interface - Remove unused dependencies (urllib3, cryptography, cffi, idna, chardet) - Load targets from a Nmap XML report -- Added --silent option to output only the full URL +- Added --urls-only option to output only the full URL ## [0.4.3] - October 2nd, 2022 - Automatically detect the URI scheme (`http` or `https`) if no scheme is provided diff --git a/README.md b/README.md index 870ea81df..6316fc276 100644 --- a/README.md +++ b/README.md @@ -266,7 +266,7 @@ Options: Show redirects history --no-color No colored output -q, --quiet-mode Quiet mode - --silent Silent mode + --urls-only Output only the full URLs Output Settings: -o PATH, --output=PATH @@ -344,7 +344,7 @@ crawl = False [view] full-url = False quiet-mode = False -silent = Faise +urls-only = Faise color = True show-redirects-history = False diff --git a/config.ini b/config.ini index ed116a8ad..923775926 100644 --- a/config.ini +++ b/config.ini @@ -67,7 +67,7 @@ crawl = False [view] full-url = False quiet-mode = False -silent = False +urls-only = False color = True show-redirects-history = False diff --git a/lib/core/data.py b/lib/core/data.py index 59f066ab7..c20019556 100755 --- a/lib/core/data.py +++ b/lib/core/data.py @@ -87,7 +87,7 @@ "redirects_history": False, "color": True, "quiet": False, - "silent": False, + "urls_only": False, "output_file": None, "output_format": None, "log_file": None, diff --git a/lib/core/options.py b/lib/core/options.py index 57d341482..b9a37c8d4 100755 --- a/lib/core/options.py +++ b/lib/core/options.py @@ -355,7 +355,7 @@ def parse_config(opt): opt.full_url = opt.full_url or config.safe_getboolean("view", "full-url") opt.color = opt.color or config.safe_getboolean("view", "color", True) opt.quiet = opt.quiet or config.safe_getboolean("view", "quiet-mode") - opt.silent = opt.silent or config.safe_getboolean("view", "silent") + opt.urls_only = opt.urls_only or config.safe_getboolean("view", "urls-only") 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 38411b467..1acbf7686 100755 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -490,7 +490,7 @@ def parse_arguments(): "-q", "--quiet-mode", action="store_true", dest="quiet", help="Quiet mode" ) view.add_option( - "--silent", action="store_true", dest="silent", help="Silent mode" + "--urls-only", action="store_true", dest="urls_only", help="Output only the full URLs" ) # Output Settings diff --git a/lib/view/terminal.py b/lib/view/terminal.py index a4acaed9e..d6bb74941 100755 --- a/lib/view/terminal.py +++ b/lib/view/terminal.py @@ -233,9 +233,9 @@ def log_file(*args): pass -class SilentCLI(QuietCLI): +class URLOnlyCLI(QuietCLI): def status_report(self, response, _): self.new_line(response.url) -interface = SilentCLI() if options["silent"] else QuietCLI() if options["quiet"] else CLI() +interface = URLOnlyCLI() if options["urls_only"] else QuietCLI() if options["quiet"] else CLI()