6767from lib .core .enums import AUTH_TYPE
6868from lib .core .enums import CUSTOM_LOGGING
6969from lib .core .enums import DUMP_FORMAT
70- from lib .core .enums import HTTPHEADER
70+ from lib .core .enums import HTTP_HEADER
7171from lib .core .enums import HTTPMETHOD
7272from lib .core .enums import MOBILES
7373from lib .core .enums import PAYLOAD
@@ -292,9 +292,9 @@ def _parseBurpLog(content):
292292 key , value = line .split (": " , 1 )
293293
294294 # Cookie and Host headers
295- if key .upper () == HTTPHEADER .COOKIE .upper ():
295+ if key .upper () == HTTP_HEADER .COOKIE .upper ():
296296 cookie = value
297- elif key .upper () == HTTPHEADER .HOST .upper ():
297+ elif key .upper () == HTTP_HEADER .HOST .upper ():
298298 if '://' in value :
299299 scheme , value = value .split ('://' )[:2 ]
300300 splitValue = value .split (":" )
@@ -306,11 +306,11 @@ def _parseBurpLog(content):
306306 # Avoid to add a static content length header to
307307 # conf.httpHeaders and consider the following lines as
308308 # POSTed data
309- if key .upper () == HTTPHEADER .CONTENT_LENGTH .upper ():
309+ if key .upper () == HTTP_HEADER .CONTENT_LENGTH .upper ():
310310 params = True
311311
312312 # Avoid proxy and connection type related headers
313- elif key not in (HTTPHEADER .PROXY_CONNECTION , HTTPHEADER .CONNECTION ):
313+ elif key not in (HTTP_HEADER .PROXY_CONNECTION , HTTP_HEADER .CONNECTION ):
314314 conf .httpHeaders .append ((getUnicode (key ), getUnicode (value )))
315315
316316 if CUSTOM_INJECTION_MARK_CHAR in re .sub (PROBLEMATIC_CUSTOM_INJECTION_PATTERNS , "" , value or "" ):
@@ -1190,16 +1190,16 @@ def _setHTTPExtraHeaders():
11901190 raise SqlmapSyntaxException (errMsg )
11911191
11921192 elif not conf .httpHeaders or len (conf .httpHeaders ) == 1 :
1193- conf .httpHeaders .append ((HTTPHEADER .ACCEPT_LANGUAGE , "en-us,en;q=0.5" ))
1193+ conf .httpHeaders .append ((HTTP_HEADER .ACCEPT_LANGUAGE , "en-us,en;q=0.5" ))
11941194 if not conf .charset :
1195- conf .httpHeaders .append ((HTTPHEADER .ACCEPT_CHARSET , "ISO-8859-15,utf-8;q=0.7,*;q=0.7" ))
1195+ conf .httpHeaders .append ((HTTP_HEADER .ACCEPT_CHARSET , "ISO-8859-15,utf-8;q=0.7,*;q=0.7" ))
11961196 else :
1197- conf .httpHeaders .append ((HTTPHEADER .ACCEPT_CHARSET , "%s;q=0.7,*;q=0.1" % conf .charset ))
1197+ conf .httpHeaders .append ((HTTP_HEADER .ACCEPT_CHARSET , "%s;q=0.7,*;q=0.1" % conf .charset ))
11981198
11991199 # Invalidating any caching mechanism in between
12001200 # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
1201- conf .httpHeaders .append ((HTTPHEADER .CACHE_CONTROL , "no-cache,no-store" ))
1202- conf .httpHeaders .append ((HTTPHEADER .PRAGMA , "no-cache" ))
1201+ conf .httpHeaders .append ((HTTP_HEADER .CACHE_CONTROL , "no-cache,no-store" ))
1202+ conf .httpHeaders .append ((HTTP_HEADER .PRAGMA , "no-cache" ))
12031203
12041204def _defaultHTTPUserAgent ():
12051205 """
@@ -1243,24 +1243,24 @@ def _setHTTPUserAgent():
12431243 except :
12441244 item = MOBILES .IPHONE
12451245
1246- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , item [1 ]))
1246+ conf .httpHeaders .append ((HTTP_HEADER .USER_AGENT , item [1 ]))
12471247
12481248 elif conf .agent :
12491249 debugMsg = "setting the HTTP User-Agent header"
12501250 logger .debug (debugMsg )
12511251
1252- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , conf .agent ))
1252+ conf .httpHeaders .append ((HTTP_HEADER .USER_AGENT , conf .agent ))
12531253
12541254 elif not conf .randomAgent :
12551255 _ = True
12561256
12571257 for header , _ in conf .httpHeaders :
1258- if header == HTTPHEADER .USER_AGENT :
1258+ if header == HTTP_HEADER .USER_AGENT :
12591259 _ = False
12601260 break
12611261
12621262 if _ :
1263- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , _defaultHTTPUserAgent ()))
1263+ conf .httpHeaders .append ((HTTP_HEADER .USER_AGENT , _defaultHTTPUserAgent ()))
12641264
12651265 else :
12661266 if not kb .userAgents :
@@ -1275,7 +1275,7 @@ def _setHTTPUserAgent():
12751275 warnMsg += "file '%s'" % paths .USER_AGENTS
12761276 logger .warn (warnMsg )
12771277
1278- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , _defaultHTTPUserAgent ()))
1278+ conf .httpHeaders .append ((HTTP_HEADER .USER_AGENT , _defaultHTTPUserAgent ()))
12791279 return
12801280
12811281 count = len (kb .userAgents )
@@ -1286,7 +1286,7 @@ def _setHTTPUserAgent():
12861286 userAgent = kb .userAgents [randomRange (stop = count - 1 )]
12871287
12881288 userAgent = sanitizeStr (userAgent )
1289- conf .httpHeaders .append ((HTTPHEADER .USER_AGENT , userAgent ))
1289+ conf .httpHeaders .append ((HTTP_HEADER .USER_AGENT , userAgent ))
12901290
12911291 infoMsg = "fetched random HTTP User-Agent header from "
12921292 infoMsg += "file '%s': %s" % (paths .USER_AGENTS , userAgent )
@@ -1301,7 +1301,7 @@ def _setHTTPReferer():
13011301 debugMsg = "setting the HTTP Referer header"
13021302 logger .debug (debugMsg )
13031303
1304- conf .httpHeaders .append ((HTTPHEADER .REFERER , conf .referer ))
1304+ conf .httpHeaders .append ((HTTP_HEADER .REFERER , conf .referer ))
13051305
13061306def _setHTTPCookies ():
13071307 """
@@ -1312,7 +1312,7 @@ def _setHTTPCookies():
13121312 debugMsg = "setting the HTTP Cookie header"
13131313 logger .debug (debugMsg )
13141314
1315- conf .httpHeaders .append ((HTTPHEADER .COOKIE , conf .cookie ))
1315+ conf .httpHeaders .append ((HTTP_HEADER .COOKIE , conf .cookie ))
13161316
13171317def _setHTTPTimeout ():
13181318 """
0 commit comments