@@ -56,12 +56,14 @@ class WebSocketException(Exception):
5656from lib .core .common import singleTimeLogMessage
5757from lib .core .common import singleTimeWarnMessage
5858from lib .core .common import stdev
59+ from lib .core .common import unArrayizeValue
5960from lib .core .common import unsafeVariableNaming
6061from lib .core .common import urldecode
6162from lib .core .common import urlencode
6263from lib .core .common import wasLastResponseDelayed
6364from lib .core .compat import patchHeaders
6465from lib .core .compat import xrange
66+ from lib .core .convert import encodeBase64
6567from lib .core .convert import getBytes
6668from lib .core .convert import getText
6769from lib .core .convert import getUnicode
@@ -466,7 +468,7 @@ def getPage(**kwargs):
466468 break
467469
468470 if post is not None and not multipart and not getHeader (headers , HTTP_HEADER .CONTENT_TYPE ):
469- headers [HTTP_HEADER .CONTENT_TYPE ] = POST_HINT_CONTENT_TYPES .get (kb .postHint , DEFAULT_CONTENT_TYPE )
471+ headers [HTTP_HEADER .CONTENT_TYPE ] = POST_HINT_CONTENT_TYPES .get (kb .postHint , DEFAULT_CONTENT_TYPE if unArrayizeValue ( conf . base64Parameter ) != HTTPMETHOD . POST else PLAIN_TEXT_CONTENT_TYPE )
470472
471473 if headers .get (HTTP_HEADER .CONTENT_TYPE ) == POST_HINT_CONTENT_TYPES [POST_HINT .MULTIPART ]:
472474 warnMsg = "missing 'boundary parameter' in '%s' header. " % HTTP_HEADER .CONTENT_TYPE
@@ -552,6 +554,13 @@ class _(dict):
552554 else :
553555 post = getBytes (post )
554556
557+ if unArrayizeValue (conf .base64Parameter ) == HTTPMETHOD .POST :
558+ if kb .place != HTTPMETHOD .POST :
559+ conf .data = getattr (conf .data , UNENCODED_ORIGINAL_VALUE , conf .data )
560+ else :
561+ post = urldecode (post , convall = True )
562+ post = encodeBase64 (post )
563+
555564 if target and cmdLineOptions .method or method and method not in (HTTPMETHOD .GET , HTTPMETHOD .POST ):
556565 req = MethodRequest (url , post , headers )
557566 req .set_method (cmdLineOptions .method or method )
@@ -976,6 +985,8 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
976985 if not place :
977986 place = kb .injection .place or PLACE .GET
978987
988+ kb .place = place
989+
979990 if not auxHeaders :
980991 auxHeaders = {}
981992
@@ -1191,7 +1202,7 @@ def _adjustParameter(paramString, parameter, newValue):
11911202
11921203 if not token :
11931204 if conf .csrfUrl and conf .csrfToken and conf .csrfUrl != conf .url and code == _http_client .OK :
1194- if headers and "text/plain" in headers .get (HTTP_HEADER .CONTENT_TYPE , "" ):
1205+ if headers and PLAIN_TEXT_CONTENT_TYPE in headers .get (HTTP_HEADER .CONTENT_TYPE , "" ):
11951206 token .name = conf .csrfToken
11961207 token .value = page
11971208
0 commit comments