mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-20 07:00:25 +00:00
Fix for --live-cookies overwriting injected Cookie parameter
This commit is contained in:
parent
26cb5cdc31
commit
2bfb53876c
2 changed files with 13 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.11.70"
|
||||
VERSION = "1.10.11.71"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
|
|
@ -425,8 +425,18 @@ class Connect(object):
|
|||
raise SqlmapValueException(errMsg)
|
||||
|
||||
with openFile(conf.liveCookies) as f:
|
||||
cookie = f.read().strip()
|
||||
cookie = re.sub(r"(?i)\ACookie:\s*", "", cookie)
|
||||
live = re.sub(r"(?i)\ACookie:\s*", "", f.read().strip())
|
||||
|
||||
# Note: (live) values are taken, except for the cookie(s) currently carrying the payload (i.e. differing from the original value)
|
||||
delimiter = conf.cookieDel or DEFAULT_COOKIE_DELIMITER
|
||||
original = conf.paramDict.get(PLACE.COOKIE) or {}
|
||||
for part in (cookie or "").split(delimiter):
|
||||
name, _, value = part.strip().partition('=')
|
||||
if name in original and value != original[name]:
|
||||
regex = r"(\A|(?<=[%s\s]))%s=[^%s]*" % (re.escape(delimiter), re.escape(name), re.escape(delimiter))
|
||||
live = re.sub(regex, lambda match: "%s=%s" % (name, value), live) if re.search(regex, live) else "%s%s %s=%s" % (live, delimiter, name, value)
|
||||
|
||||
cookie = live
|
||||
|
||||
if multipart:
|
||||
post = multipart
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue