diff --git a/lib/core/common.py b/lib/core/common.py index 631775331..38fe61919 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -539,7 +539,7 @@ def paramToDict(place, parameters=None): parameters = parameters.replace(", ", ",") parameters = re.sub(r"&(\w{1,4});", r"%s\g<1>%s" % (PARAMETER_AMP_MARKER, PARAMETER_SEMICOLON_MARKER), parameters) if place == PLACE.COOKIE: - splitParams = parameters.split(conf.cDel or DEFAULT_COOKIE_DELIMITER) + splitParams = parameters.split(conf.cookieDel or DEFAULT_COOKIE_DELIMITER) else: splitParams = parameters.split(conf.paramDel or DEFAULT_GET_POST_DELIMITER) diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 7694c0fdf..338c686e8 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -25,7 +25,7 @@ optDict = { "data": "string", "paramDel": "string", "cookie": "string", - "cDel": "string", + "cookieDel": "string", "loadCookies": "string", "dropSetCookie": "boolean", "agent": "string", diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index f5418a0f1..59fde8517 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -88,7 +88,7 @@ def cmdLineParser(): request.add_option("--cookie", dest="cookie", help="HTTP Cookie header value") - request.add_option("--cookie-del", dest="cDel", + request.add_option("--cookie-del", dest="cookieDel", help="Character used for splitting cookie values") request.add_option("--load-cookies", dest="loadCookies", diff --git a/lib/request/basic.py b/lib/request/basic.py index d6ca0db2e..5947efe06 100755 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -94,7 +94,7 @@ def forgeHeaders(items=None): kb.mergeCookies = not _ or _[0] in ("y", "Y") if kb.mergeCookies: - _ = lambda x: re.sub("(?i)%s=[^%s]+" % (cookie.name, conf.cDel or DEFAULT_COOKIE_DELIMITER), "%s=%s" % (cookie.name, getUnicode(cookie.value)), x) + _ = lambda x: re.sub("(?i)%s=[^%s]+" % (cookie.name, conf.cookieDel or DEFAULT_COOKIE_DELIMITER), "%s=%s" % (cookie.name, getUnicode(cookie.value)), x) headers[HTTP_HEADER.COOKIE] = _(headers[HTTP_HEADER.COOKIE]) if PLACE.COOKIE in conf.parameters: @@ -103,7 +103,7 @@ def forgeHeaders(items=None): conf.httpHeaders = [(item[0], item[1] if item[0] != HTTP_HEADER.COOKIE else _(item[1])) for item in conf.httpHeaders] elif not kb.testMode: - headers[HTTP_HEADER.COOKIE] += "%s %s=%s" % (conf.cDel or DEFAULT_COOKIE_DELIMITER, cookie.name, getUnicode(cookie.value)) + headers[HTTP_HEADER.COOKIE] += "%s %s=%s" % (conf.cookieDel or DEFAULT_COOKIE_DELIMITER, cookie.name, getUnicode(cookie.value)) if kb.testMode: resetCookieJar(conf.cj) diff --git a/lib/request/connect.py b/lib/request/connect.py index b683c6991..bf2b5e25a 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -769,7 +769,7 @@ class Connect(object): evaluateCode("%s=%s" % (name.strip(), repr(value)), variables) if cookie: - for part in cookie.split(conf.cDel or DEFAULT_COOKIE_DELIMITER): + for part in cookie.split(conf.cookieDel or DEFAULT_COOKIE_DELIMITER): if '=' in part: name, value = part.split('=', 1) value = urldecode(value, convall=True) @@ -793,7 +793,7 @@ class Connect(object): found = True post = re.sub(regex, "\g<1>%s\g<3>" % value, post) - regex = r"((\A|%s)%s=).+?(%s|\Z)" % (re.escape(conf.cDel or DEFAULT_COOKIE_DELIMITER), name, re.escape(conf.cDel or DEFAULT_COOKIE_DELIMITER)) + regex = r"((\A|%s)%s=).+?(%s|\Z)" % (re.escape(conf.cookieDel or DEFAULT_COOKIE_DELIMITER), name, re.escape(conf.cookieDel or DEFAULT_COOKIE_DELIMITER)) if re.search(regex, (cookie or "")): found = True cookie = re.sub(regex, "\g<1>%s\g<3>" % value, cookie) @@ -804,7 +804,7 @@ class Connect(object): elif get is not None: get += "%s%s=%s" % (delimiter, name, value) elif cookie is not None: - cookie += "%s%s=%s" % (conf.cDel or DEFAULT_COOKIE_DELIMITER, name, value) + cookie += "%s%s=%s" % (conf.cookieDel or DEFAULT_COOKIE_DELIMITER, name, value) if not conf.skipUrlEncode: get = urlencode(get, limit=True) diff --git a/lib/request/redirecthandler.py b/lib/request/redirecthandler.py index ec893aed2..bbc566095 100644 --- a/lib/request/redirecthandler.py +++ b/lib/request/redirecthandler.py @@ -113,7 +113,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler): if redurl and kb.redirectChoice == REDIRECTION.YES: req.headers[HTTP_HEADER.HOST] = getHostHeader(redurl) if headers and HTTP_HEADER.SET_COOKIE in headers: - req.headers[HTTP_HEADER.COOKIE] = headers[HTTP_HEADER.SET_COOKIE].split(conf.cDel or DEFAULT_COOKIE_DELIMITER)[0] + req.headers[HTTP_HEADER.COOKIE] = headers[HTTP_HEADER.SET_COOKIE].split(conf.cookieDel or DEFAULT_COOKIE_DELIMITER)[0] result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers) else: result = fp diff --git a/sqlmap.conf b/sqlmap.conf index 942888d41..210fa4259 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -46,7 +46,7 @@ paramDel = cookie = # Character used for splitting cookie values -cDel = +cookieDel = # File containing cookies in Netscape/wget format loadCookies =