mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +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 = pointer.next[char]
|
||||||
pointer.current.append(option)
|
pointer.current.append(option)
|
||||||
|
|
||||||
for mnemonic in mnemonics.split(','):
|
for mnemonic in (mnemonics or "").split(','):
|
||||||
found = None
|
found = None
|
||||||
name = mnemonic.split('=')[0].replace("-", "").strip()
|
name = mnemonic.split('=')[0].replace("-", "").strip()
|
||||||
value = mnemonic.split('=')[1] if len(mnemonic.split('=')) > 1 else None
|
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")
|
conf.headers = conf.headers.split("\n") if "\n" in conf.headers else conf.headers.split("\\n")
|
||||||
|
|
||||||
for headerValue in conf.headers:
|
for headerValue in conf.headers:
|
||||||
|
if not headerValue.strip():
|
||||||
|
continue
|
||||||
|
|
||||||
if headerValue.count(':') >= 1:
|
if headerValue.count(':') >= 1:
|
||||||
header, value = (_.lstrip() for _ in headerValue.split(":", 1))
|
header, value = (_.lstrip() for _ in headerValue.split(":", 1))
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ def cmdLineParser():
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Ignore Set-Cookie header from response")
|
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")
|
help="HTTP User-Agent header value")
|
||||||
|
|
||||||
request.add_option("--random-agent", dest="randomAgent",
|
request.add_option("--random-agent", dest="randomAgent",
|
||||||
|
@ -127,6 +127,9 @@ def cmdLineParser():
|
||||||
request.add_option("--referer", dest="referer",
|
request.add_option("--referer", dest="referer",
|
||||||
help="HTTP Referer header value")
|
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",
|
request.add_option("--headers", dest="headers",
|
||||||
help="Extra headers (e.g. \"Accept-Language: fr\\nETag: 123\")")
|
help="Extra headers (e.g. \"Accept-Language: fr\\nETag: 123\")")
|
||||||
|
|
||||||
|
@ -799,6 +802,7 @@ def cmdLineParser():
|
||||||
argv = []
|
argv = []
|
||||||
prompt = False
|
prompt = False
|
||||||
advancedHelp = True
|
advancedHelp = True
|
||||||
|
extraHeaders = []
|
||||||
|
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
argv.append(getUnicode(arg, encoding=sys.getfilesystemencoding()))
|
argv.append(getUnicode(arg, encoding=sys.getfilesystemencoding()))
|
||||||
|
@ -860,6 +864,9 @@ def cmdLineParser():
|
||||||
for i in xrange(len(argv)):
|
for i in xrange(len(argv)):
|
||||||
if argv[i] == "-hh":
|
if argv[i] == "-hh":
|
||||||
argv[i] = "-h"
|
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]):
|
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]
|
argv[i] = argv[i][:-1]
|
||||||
conf.skipThreadCheck = True
|
conf.skipThreadCheck = True
|
||||||
|
@ -888,6 +895,12 @@ def cmdLineParser():
|
||||||
print "\n[!] to see full list of options run with '-hh'"
|
print "\n[!] to see full list of options run with '-hh'"
|
||||||
raise
|
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")
|
# Expand given mnemonic options (e.g. -z "ign,flu,bat")
|
||||||
for i in xrange(len(argv) - 1):
|
for i in xrange(len(argv) - 1):
|
||||||
if argv[i] == "-z":
|
if argv[i] == "-z":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user