mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
little refactoring
This commit is contained in:
parent
c301b245a9
commit
75c0e09f43
|
@ -75,6 +75,7 @@ class HTTPHEADER:
|
||||||
CONNECTION = "Connection"
|
CONNECTION = "Connection"
|
||||||
ACCEPT_ENCODING = "Accept-Encoding"
|
ACCEPT_ENCODING = "Accept-Encoding"
|
||||||
REFERER = "Referer"
|
REFERER = "Referer"
|
||||||
|
USER_AGENT = "User-Agent"
|
||||||
|
|
||||||
class EXPECTED:
|
class EXPECTED:
|
||||||
BOOL = "bool"
|
BOOL = "bool"
|
||||||
|
|
|
@ -53,6 +53,7 @@ from lib.core.data import queries
|
||||||
from lib.core.datatype import advancedDict
|
from lib.core.datatype import advancedDict
|
||||||
from lib.core.datatype import injectionDict
|
from lib.core.datatype import injectionDict
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
|
from lib.core.enums import HTTPHEADER
|
||||||
from lib.core.enums import HTTPMETHOD
|
from lib.core.enums import HTTPMETHOD
|
||||||
from lib.core.enums import PAYLOAD
|
from lib.core.enums import PAYLOAD
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
|
@ -1003,7 +1004,7 @@ def __setHTTPUserAgent():
|
||||||
warnMsg += "file '%s'" % paths.USER_AGENTS
|
warnMsg += "file '%s'" % paths.USER_AGENTS
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent()))
|
conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __defaultHTTPUserAgent()))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1015,7 +1016,7 @@ def __setHTTPUserAgent():
|
||||||
__userAgent = kb.userAgents[randomRange(stop=__count-1)]
|
__userAgent = kb.userAgents[randomRange(stop=__count-1)]
|
||||||
|
|
||||||
__userAgent = sanitizeStr(__userAgent)
|
__userAgent = sanitizeStr(__userAgent)
|
||||||
conf.httpHeaders.append(("User-Agent", __userAgent))
|
conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __userAgent))
|
||||||
|
|
||||||
logMsg = "fetched random HTTP User-Agent header from "
|
logMsg = "fetched random HTTP User-Agent header from "
|
||||||
logMsg += "file '%s': %s" % (paths.USER_AGENTS, __userAgent)
|
logMsg += "file '%s': %s" % (paths.USER_AGENTS, __userAgent)
|
||||||
|
@ -1030,13 +1031,13 @@ def __setHTTPReferer():
|
||||||
debugMsg = "setting the HTTP Referer header"
|
debugMsg = "setting the HTTP Referer header"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
conf.httpHeaders.append(("Referer", conf.referer))
|
conf.httpHeaders.append((HTTPHEADER.REFERER, conf.referer))
|
||||||
|
|
||||||
elif conf.level >= 3:
|
elif conf.level >= 3:
|
||||||
debugMsg = "setting the default HTTP Referer header"
|
debugMsg = "setting the default HTTP Referer header"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
conf.httpHeaders.append(("Referer", conf.url))
|
conf.httpHeaders.append((HTTPHEADER.REFERER, conf.url))
|
||||||
|
|
||||||
def __setHTTPCookies():
|
def __setHTTPCookies():
|
||||||
"""
|
"""
|
||||||
|
@ -1047,8 +1048,8 @@ def __setHTTPCookies():
|
||||||
debugMsg = "setting the HTTP Cookie header"
|
debugMsg = "setting the HTTP Cookie header"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
conf.httpHeaders.append(("Connection", "Keep-Alive"))
|
conf.httpHeaders.append((HTTPHEADER.CONNECTION, "Keep-Alive"))
|
||||||
conf.httpHeaders.append(("Cookie", conf.cookie))
|
conf.httpHeaders.append((HTTPHEADER.COOKIE, conf.cookie))
|
||||||
|
|
||||||
def __setHTTPTimeout():
|
def __setHTTPTimeout():
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user