From 3b3ab072e67bdb90dedbf9d8750db46a6ddab783 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 29 Sep 2016 11:19:25 +0200 Subject: [PATCH] Adding short option(s) for setting verbosity (e.g. -vvv) --- lib/core/settings.py | 2 +- lib/parse/cmdline.py | 9 ++++++++- txt/checksum.md5 | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index e8683b538..31d0ed9ea 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.9.51" +VERSION = "1.0.9.52" REVISION = getRevisionNumber() TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 544d0e527..364a80a54 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -885,7 +885,6 @@ def cmdLineParser(argv=None): except ValueError, ex: raise SqlmapSyntaxException, "something went wrong during command line parsing ('%s')" % ex.message - # Hide non-basic options in basic help case for i in xrange(len(argv)): if argv[i] == "-hh": argv[i] = "-h" @@ -913,6 +912,14 @@ def cmdLineParser(argv=None): if not found: parser.option_groups.remove(group) + for verbosity in (_ for _ in argv if re.search(r"\A\-v+\Z", _)): + try: + if argv.index(verbosity) == len(argv) - 1 or not argv[argv.index(verbosity) + 1].isdigit(): + conf.verbose = verbosity.count('v') + 1 + del argv[argv.index(verbosity)] + except (IndexError, ValueError): + pass + try: (args, _) = parser.parse_args(argv) except UnicodeEncodeError, ex: diff --git a/txt/checksum.md5 b/txt/checksum.md5 index ae11ffca5..7e45cfaed 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -45,7 +45,7 @@ e60456db5380840a586654344003d4e6 lib/core/readlineng.py 5ef56abb8671c2ca6ceecb208258e360 lib/core/replication.py 99a2b496b9d5b546b335653ca801153f lib/core/revision.py 7c15dd2777af4dac2c89cab6df17462e lib/core/session.py -9652b7cb6777148034310c0e66b2e85a lib/core/settings.py +ddab16d302a21444b7f12de4630af2df lib/core/settings.py 7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py 23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py c3ace7874a536d801f308cf1fd03df99 lib/core/target.py @@ -56,7 +56,7 @@ d43f059747ffd48952922c94152e2a07 lib/core/testing.py 8485a3cd94c0a5af2718bad60c5f1ae5 lib/core/wordlist.py cc9c82cfffd8ee9b25ba3af6284f057e lib/__init__.py c1288bc4ce5651dbdd82d4a9435fdc03 lib/parse/banner.py -498be08b12a01bd79d82fc993bd07965 lib/parse/cmdline.py +bc8a27a451d988398d7e25a786b2c8a2 lib/parse/cmdline.py 8ec4d4f02634834701f8258726f2e511 lib/parse/configfile.py fe4e2152292587928edb94c9a4d311ff lib/parse/handler.py 8e6bfb13e5a34b2610f3ff23467a34cf lib/parse/headers.py