@@ -148,12 +148,13 @@ def _setRequestParams():
148148 elif test [0 ] in ("q" , "Q" ):
149149 raise SqlmapUserQuitException
150150
151- for place , value in ((PLACE .URI , conf .url ), (PLACE .CUSTOM_POST , conf .data ), (PLACE .CUSTOM_HEADER , re .sub (r"\bq=[^;']+" , "" , str (conf .httpHeaders )))):
152- if CUSTOM_INJECTION_MARK_CHAR in (value or "" ):
151+ for place , value in ((PLACE .URI , conf .url ), (PLACE .CUSTOM_POST , conf .data ), (PLACE .CUSTOM_HEADER , str (conf .httpHeaders ))):
152+ _ = re .sub (r"\bq=[^;']+" , "" , value or "" )
153+ if CUSTOM_INJECTION_MARK_CHAR in _ :
153154 if kb .processUserMarks is None :
154- _ = {PLACE .URI : '-u' , PLACE .CUSTOM_POST : '--data' , PLACE .CUSTOM_HEADER : '--headers/--user-agent/--referer' }
155+ lut = {PLACE .URI : '-u' , PLACE .CUSTOM_POST : '--data' , PLACE .CUSTOM_HEADER : '--headers/--user-agent/--referer/--cookie ' }
155156 message = "custom injection marking character ('%s') found in option " % CUSTOM_INJECTION_MARK_CHAR
156- message += "'%s'. Do you want to process it? [Y/n/q] " % _ [place ]
157+ message += "'%s'. Do you want to process it? [Y/n/q] " % lut [place ]
157158 test = readInput (message , default = "Y" )
158159 if test and test [0 ] in ("q" , "Q" ):
159160 raise SqlmapUserQuitException
@@ -187,7 +188,9 @@ def _setRequestParams():
187188 for index in xrange (len (conf .httpHeaders )):
188189 header , value = conf .httpHeaders [index ]
189190 if CUSTOM_INJECTION_MARK_CHAR in re .sub (r"\bq=[^;']+" , "" , value ):
190- conf .paramDict [place ][header ] = "%s,%s" % (header , value )
191+ parts = value .split (CUSTOM_INJECTION_MARK_CHAR )
192+ for i in xrange (len (parts ) - 1 ):
193+ conf .paramDict [place ]["%s #%d%s" % (header , i + 1 , CUSTOM_INJECTION_MARK_CHAR )] = "%s,%s" % (header , "" .join ("%s%s" % (parts [j ], CUSTOM_INJECTION_MARK_CHAR if i == j else "" ) for j in xrange (len (parts ))))
191194 conf .httpHeaders [index ] = (header , value .replace (CUSTOM_INJECTION_MARK_CHAR , "" ))
192195 else :
193196 parts = value .split (CUSTOM_INJECTION_MARK_CHAR )
@@ -203,8 +206,9 @@ def _setRequestParams():
203206 testableParameters = True
204207
205208 if kb .processUserMarks :
206- conf .url = conf .url .replace (CUSTOM_INJECTION_MARK_CHAR , "" )
207- conf .data = conf .data .replace (CUSTOM_INJECTION_MARK_CHAR , "" ) if conf .data else conf .data
209+ for item in ("url" , "data" , "agent" , "referer" , "cookie" ):
210+ if conf .get (item ):
211+ conf [item ] = conf [item ].replace (CUSTOM_INJECTION_MARK_CHAR , "" )
208212
209213 # Perform checks on Cookie parameters
210214 if conf .cookie :
0 commit comments