mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-10 09:49:06 +00:00
More replacements for refactoring.
Minor layout adjustments. Alignment of conffile/optiondict/cmdline parameters.
This commit is contained in:
@@ -1570,7 +1570,9 @@ def runningAsAdmin():
|
||||
|
||||
def logHTTPTraffic(requestLogMsg, responseLogMsg):
|
||||
kb.locks.reqLock.acquire()
|
||||
|
||||
dataToTrafficFile("%s\n" % requestLogMsg)
|
||||
dataToTrafficFile("%s\n" % responseLogMsg)
|
||||
dataToTrafficFile("%s\n" % (160*'#'))
|
||||
dataToTrafficFile("\n%s\n\n" % (76 * '#'))
|
||||
|
||||
kb.locks.reqLock.release()
|
||||
|
||||
@@ -43,6 +43,7 @@ from lib.core.data import paths
|
||||
from lib.core.data import queries
|
||||
from lib.core.datatype import advancedDict
|
||||
from lib.core.enums import HTTPMETHOD
|
||||
from lib.core.enums import PLACE
|
||||
from lib.core.enums import PRIORITY
|
||||
from lib.core.exception import sqlmapFilePathException
|
||||
from lib.core.exception import sqlmapGenericException
|
||||
@@ -765,7 +766,7 @@ def __setHTTPAuthentication():
|
||||
errMsg += "must be in format key_file,cert_file"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
#os.path.expanduser for support of paths with ~
|
||||
# os.path.expanduser for support of paths with ~
|
||||
key_file = os.path.expanduser(aCertRegExp.group(1))
|
||||
cert_file = os.path.expanduser(aCertRegExp.group(2))
|
||||
|
||||
@@ -847,19 +848,19 @@ def __setHTTPUserAgent():
|
||||
debugMsg = "setting the HTTP User-Agent header"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
conf.httpHeaders.append(("User-Agent", conf.agent))
|
||||
conf.httpHeaders.append((PLACE.UA, conf.agent))
|
||||
return
|
||||
|
||||
if not conf.userAgentsFile:
|
||||
addDefaultUserAgent = True
|
||||
|
||||
for header, _ in conf.httpHeaders:
|
||||
if header == "User-Agent":
|
||||
if header == PLACE.UA:
|
||||
addDefaultUserAgent = False
|
||||
break
|
||||
|
||||
if addDefaultUserAgent:
|
||||
conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent()))
|
||||
conf.httpHeaders.append((PLACE.UA, __defaultHTTPUserAgent()))
|
||||
|
||||
return
|
||||
|
||||
@@ -875,7 +876,7 @@ def __setHTTPUserAgent():
|
||||
warnMsg += "file '%s'" % conf.userAgentsFile
|
||||
logger.warn(warnMsg)
|
||||
|
||||
conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent()))
|
||||
conf.httpHeaders.append((PLACE.UA, __defaultHTTPUserAgent()))
|
||||
|
||||
return
|
||||
|
||||
@@ -887,7 +888,7 @@ def __setHTTPUserAgent():
|
||||
__userAgent = kb.userAgents[randomRange(stop=__count)]
|
||||
|
||||
__userAgent = sanitizeStr(__userAgent)
|
||||
conf.httpHeaders.append(("User-Agent", __userAgent))
|
||||
conf.httpHeaders.append((PLACE.UA, __userAgent))
|
||||
|
||||
logMsg = "fetched random HTTP User-Agent header from "
|
||||
logMsg += "file '%s': %s" % (conf.userAgentsFile, __userAgent)
|
||||
@@ -914,7 +915,7 @@ def __setHTTPCookies():
|
||||
logger.debug(debugMsg)
|
||||
|
||||
conf.httpHeaders.append(("Connection", "Keep-Alive"))
|
||||
conf.httpHeaders.append(("Cookie", conf.cookie))
|
||||
conf.httpHeaders.append((PLACE.COOKIE, conf.cookie))
|
||||
|
||||
def __setHTTPTimeout():
|
||||
"""
|
||||
|
||||
@@ -59,14 +59,17 @@ optDict = {
|
||||
"os": "string",
|
||||
"prefix": "string",
|
||||
"postfix": "string",
|
||||
"tamper": "string"
|
||||
},
|
||||
|
||||
"Detection": {
|
||||
"string": "string",
|
||||
"regexp": "string",
|
||||
"eString": "string",
|
||||
"eRegexp": "string",
|
||||
"thold": "float",
|
||||
"textOnly": "boolean",
|
||||
"longestCommon": "boolean",
|
||||
"tamper": "string"
|
||||
"longestCommon": "boolean"
|
||||
},
|
||||
|
||||
"Techniques": {
|
||||
@@ -147,6 +150,7 @@ optDict = {
|
||||
"Miscellaneous": {
|
||||
"xmlFile": "string",
|
||||
"sessionFile": "string",
|
||||
"trafficFile": "string",
|
||||
"flushSession": "boolean",
|
||||
"forms": "boolean",
|
||||
"eta": "boolean",
|
||||
@@ -155,6 +159,8 @@ optDict = {
|
||||
"batch": "boolean",
|
||||
"cleanup": "boolean",
|
||||
"replicate": "boolean",
|
||||
"checkPayload": "boolean",
|
||||
"beep": "boolean",
|
||||
"verbose": "integer"
|
||||
},
|
||||
}
|
||||
|
||||
@@ -99,12 +99,12 @@ def __setRequestParams():
|
||||
# Perform checks on User-Agent header value
|
||||
if conf.httpHeaders:
|
||||
for httpHeader, headerValue in conf.httpHeaders:
|
||||
if httpHeader == "User-Agent":
|
||||
if httpHeader == PLACE.UA:
|
||||
# No need for url encoding/decoding the user agent
|
||||
conf.parameters[PLACE.UA] = headerValue
|
||||
|
||||
condition = not conf.testParameter
|
||||
condition |= "User-Agent" in conf.testParameter
|
||||
condition |= PLACE.UA in conf.testParameter
|
||||
condition |= "user-agent" in conf.testParameter
|
||||
condition |= "useragent" in conf.testParameter
|
||||
condition |= "ua" in conf.testParameter
|
||||
|
||||
Reference in New Issue
Block a user