From 505647b00fb50dfbd7b34cb92428734fa07f1ca8 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Fri, 15 Jan 2010 11:24:30 +0000 Subject: [PATCH] Minor bug fix to --cookie-urlencode --- lib/core/agent.py | 6 ------ lib/request/basic.py | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index d85a08833..5a7dda93d 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -26,7 +26,6 @@ import re from lib.core.common import randomInt from lib.core.common import randomStr -from lib.core.convert import urlencode from lib.core.data import conf from lib.core.data import kb from lib.core.data import queries @@ -79,11 +78,6 @@ class Agent: retValue = paramString.replace("%s=%s" % (parameter, value), "%s=%s" % (parameter, newValue)) - if conf.cookieUrlencode and (kb.injPlace == "Cookie" or place == "Cookie"): - name = retValue[:retValue.find('=')] - value = retValue[retValue.find('=') + 1:] - retValue = "%s=%s" % (name, urlencode(value, convall=True)) - return retValue def fullPayload(self, query): diff --git a/lib/request/basic.py b/lib/request/basic.py index f02613914..01cf726ea 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -28,9 +28,10 @@ import re import StringIO import zlib +from lib.core.common import directoryPath +from lib.core.common import sanitizeCookie from lib.core.data import conf from lib.core.data import kb -from lib.core.common import directoryPath from lib.parse.headers import headersParser from lib.parse.html import htmlParser @@ -44,6 +45,9 @@ def forgeHeaders(cookie, ua): for header, value in conf.httpHeaders: if cookie and header == "Cookie": + if conf.cookieUrlencode: + cookie = sanitizeCookie(cookie) + headers[header] = cookie elif ua and header == "User-Agent": headers[header] = ua