mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
Adding a --version switch like all command line programs have
This commit is contained in:
@@ -21,6 +21,7 @@ from lib.core.settings import BASIC_HELP_ITEMS
|
|||||||
from lib.core.settings import DUMMY_URL
|
from lib.core.settings import DUMMY_URL
|
||||||
from lib.core.settings import IS_WIN
|
from lib.core.settings import IS_WIN
|
||||||
from lib.core.settings import MAX_HELP_OPTION_LENGTH
|
from lib.core.settings import MAX_HELP_OPTION_LENGTH
|
||||||
|
from lib.core.settings import VERSION_STRING
|
||||||
|
|
||||||
def cmdLineParser():
|
def cmdLineParser():
|
||||||
"""
|
"""
|
||||||
@@ -37,6 +38,10 @@ def cmdLineParser():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Show advanced help message and exit")
|
help="Show advanced help message and exit")
|
||||||
|
|
||||||
|
parser.add_option("--version", dest="showVersion",
|
||||||
|
action="store_true",
|
||||||
|
help="Show version string and exit")
|
||||||
|
|
||||||
parser.add_option("-v", dest="verbose", type="int",
|
parser.add_option("-v", dest="verbose", type="int",
|
||||||
help="Verbosity level: 0-6 (default %d)" % defaults.verbose)
|
help="Verbosity level: 0-6 (default %d)" % defaults.verbose)
|
||||||
|
|
||||||
@@ -740,6 +745,9 @@ def cmdLineParser():
|
|||||||
for i in xrange(len(sys.argv)):
|
for i in xrange(len(sys.argv)):
|
||||||
if sys.argv[i] == '-hh':
|
if sys.argv[i] == '-hh':
|
||||||
sys.argv[i] = '-h'
|
sys.argv[i] = '-h'
|
||||||
|
elif sys.argv[i] == '--version':
|
||||||
|
print VERSION_STRING
|
||||||
|
raise SystemExit
|
||||||
elif sys.argv[i] == '-h':
|
elif sys.argv[i] == '-h':
|
||||||
advancedHelp = False
|
advancedHelp = False
|
||||||
for group in parser.option_groups[:]:
|
for group in parser.option_groups[:]:
|
||||||
|
|||||||
Reference in New Issue
Block a user