2626from lib .core .data import paths
2727from lib .core .dump import dumper
2828from lib .core .enums import HASHDB_KEYS
29+ from lib .core .enums import HTTPHEADER
2930from lib .core .enums import HTTPMETHOD
3031from lib .core .enums import PLACE
3132from lib .core .exception import sqlmapFilePathException
@@ -158,16 +159,18 @@ def __setRequestParams():
158159 # Url encoding of the header values should be avoided
159160 # Reference: http://stackoverflow.com/questions/5085904/is-ok-to-urlencode-the-value-in-headerlocation-value
160161
161- if httpHeader == PLACE .UA :
162- conf .parameters [PLACE .UA ] = urldecode (headerValue )
162+ httpHeader = "-" .join (_ .capitalize () for _ in (httpHeader or "" ).split ("-" ))
163+
164+ if httpHeader == HTTPHEADER .USER_AGENT :
165+ conf .parameters [PLACE .USER_AGENT ] = urldecode (headerValue )
163166
164167 condition = any ((not conf .testParameter , intersect (conf .testParameter , USER_AGENT_ALIASES )))
165168
166169 if condition :
167- conf .paramDict [PLACE .UA ] = {PLACE .UA : headerValue }
170+ conf .paramDict [PLACE .USER_AGENT ] = {PLACE .USER_AGENT : headerValue }
168171 testableParameters = True
169172
170- elif httpHeader == PLACE .REFERER :
173+ elif httpHeader == HTTPHEADER .REFERER :
171174 conf .parameters [PLACE .REFERER ] = urldecode (headerValue )
172175
173176 condition = any ((not conf .testParameter , intersect (conf .testParameter , REFERER_ALIASES )))
@@ -176,7 +179,7 @@ def __setRequestParams():
176179 conf .paramDict [PLACE .REFERER ] = {PLACE .REFERER : headerValue }
177180 testableParameters = True
178181
179- elif httpHeader == PLACE .HOST :
182+ elif httpHeader == HTTPHEADER .HOST :
180183 conf .parameters [PLACE .HOST ] = urldecode (headerValue )
181184
182185 condition = any ((not conf .testParameter , intersect (conf .testParameter , HOST_ALIASES )))
0 commit comments