mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Fixes #1293
This commit is contained in:
parent
f488377001
commit
2080fcaa37
|
@ -3285,7 +3285,7 @@ def expandMnemonics(mnemonics, parser, args):
|
|||
pointer = pointer.next[char]
|
||||
pointer.current.append(option)
|
||||
|
||||
for mnemonic in mnemonics.split(','):
|
||||
for mnemonic in (mnemonics or "").split(','):
|
||||
found = None
|
||||
name = mnemonic.split('=')[0].replace("-", "").strip()
|
||||
value = mnemonic.split('=')[1] if len(mnemonic.split('=')) > 1 else None
|
||||
|
|
|
@ -1339,6 +1339,9 @@ def _setHTTPExtraHeaders():
|
|||
conf.headers = conf.headers.split("\n") if "\n" in conf.headers else conf.headers.split("\\n")
|
||||
|
||||
for headerValue in conf.headers:
|
||||
if not headerValue.strip():
|
||||
continue
|
||||
|
||||
if headerValue.count(':') >= 1:
|
||||
header, value = (_.lstrip() for _ in headerValue.split(":", 1))
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ def cmdLineParser():
|
|||
action="store_true",
|
||||
help="Ignore Set-Cookie header from response")
|
||||
|
||||
request.add_option("-H", "--user-agent", dest="agent",
|
||||
request.add_option("--user-agent", dest="agent",
|
||||
help="HTTP User-Agent header value")
|
||||
|
||||
request.add_option("--random-agent", dest="randomAgent",
|
||||
|
@ -127,6 +127,9 @@ def cmdLineParser():
|
|||
request.add_option("--referer", dest="referer",
|
||||
help="HTTP Referer header value")
|
||||
|
||||
request.add_option("-H", "--header", dest="header",
|
||||
help="Extra header (e.g. \"X-Forwarded-For: 127.0.0.1\")")
|
||||
|
||||
request.add_option("--headers", dest="headers",
|
||||
help="Extra headers (e.g. \"Accept-Language: fr\\nETag: 123\")")
|
||||
|
||||
|
@ -799,6 +802,7 @@ def cmdLineParser():
|
|||
argv = []
|
||||
prompt = False
|
||||
advancedHelp = True
|
||||
extraHeaders = []
|
||||
|
||||
for arg in sys.argv:
|
||||
argv.append(getUnicode(arg, encoding=sys.getfilesystemencoding()))
|
||||
|
@ -860,6 +864,9 @@ def cmdLineParser():
|
|||
for i in xrange(len(argv)):
|
||||
if argv[i] == "-hh":
|
||||
argv[i] = "-h"
|
||||
elif argv[i] == "-H":
|
||||
if i + 1 < len(argv):
|
||||
extraHeaders.append(argv[i + 1])
|
||||
elif re.match(r"\A\d+!\Z", argv[i]) and argv[max(0, i - 1)] == "--threads" or re.match(r"\A--threads.+\d+!\Z", argv[i]):
|
||||
argv[i] = argv[i][:-1]
|
||||
conf.skipThreadCheck = True
|
||||
|
@ -888,6 +895,12 @@ def cmdLineParser():
|
|||
print "\n[!] to see full list of options run with '-hh'"
|
||||
raise
|
||||
|
||||
if extraHeaders:
|
||||
if not args.headers:
|
||||
args.headers = ""
|
||||
delimiter = "\\n" if "\\n" in args.headers else "\n"
|
||||
args.headers += delimiter + delimiter.join(extraHeaders)
|
||||
|
||||
# Expand given mnemonic options (e.g. -z "ign,flu,bat")
|
||||
for i in xrange(len(argv) - 1):
|
||||
if argv[i] == "-z":
|
||||
|
|
Loading…
Reference in New Issue
Block a user