mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-21 15:41:54 +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
|
|
@ -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