@@ -1356,7 +1356,27 @@ def _randomizeParameter(paramString, randomParameter):
13561356 found = False
13571357 value = getUnicode (value , UNICODE_ENCODING )
13581358
1359- if kb .postHint and re .search (r"\b%s\b" % re .escape (name ), post or "" ):
1359+ if kb .postHint == POST_HINT .MULTIPART :
1360+ boundary = "--%s" % re .search (r"boundary=([^\s]+)" , contentType ).group (1 )
1361+ if boundary :
1362+ parts = post .split (boundary )
1363+ match = re .search (r'\bname="%s"' % re .escape (name ), post )
1364+ if not match and parts :
1365+ parts .insert (2 , parts [1 ])
1366+ parts [2 ] = re .sub (r'\bname="[^"]+".*' , 'name="%s"' % re .escape (name ), parts [2 ])
1367+ for i in xrange (len (parts )):
1368+ part = parts [i ]
1369+ if re .search (r'\bname="%s"' % re .escape (name ), part ):
1370+ match = re .search (r"(?s)\A.+?\r?\n\r?\n" , part )
1371+ if match :
1372+ found = True
1373+ first = match .group (0 )
1374+ second = part [len (first ):]
1375+ second = re .sub (r"(?s).+?(\r?\n?\-*\Z)" , r"%s\g<1>" % re .escape (value ), second )
1376+ parts [i ] = "%s%s" % (first , second )
1377+ post = boundary .join (parts )
1378+
1379+ elif kb .postHint and re .search (r"\b%s\b" % re .escape (name ), post or "" ):
13601380 if kb .postHint in (POST_HINT .XML , POST_HINT .SOAP ):
13611381 if re .search (r"<%s\b" % re .escape (name ), post ):
13621382 found = True
0 commit comments