Minor bug fix to --cookie-urlencode

This commit is contained in:
Bernardo Damele 2010-01-15 11:24:30 +00:00
parent c4215ce8d2
commit 505647b00f
2 changed files with 5 additions and 7 deletions

View File

@ -26,7 +26,6 @@ import re
from lib.core.common import randomInt from lib.core.common import randomInt
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.convert import urlencode
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import queries from lib.core.data import queries
@ -79,11 +78,6 @@ class Agent:
retValue = paramString.replace("%s=%s" % (parameter, value), retValue = paramString.replace("%s=%s" % (parameter, value),
"%s=%s" % (parameter, newValue)) "%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 return retValue
def fullPayload(self, query): def fullPayload(self, query):

View File

@ -28,9 +28,10 @@ import re
import StringIO import StringIO
import zlib 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 conf
from lib.core.data import kb from lib.core.data import kb
from lib.core.common import directoryPath
from lib.parse.headers import headersParser from lib.parse.headers import headersParser
from lib.parse.html import htmlParser from lib.parse.html import htmlParser
@ -44,6 +45,9 @@ def forgeHeaders(cookie, ua):
for header, value in conf.httpHeaders: for header, value in conf.httpHeaders:
if cookie and header == "Cookie": if cookie and header == "Cookie":
if conf.cookieUrlencode:
cookie = sanitizeCookie(cookie)
headers[header] = cookie headers[header] = cookie
elif ua and header == "User-Agent": elif ua and header == "User-Agent":
headers[header] = ua headers[header] = ua