mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-09 22:21:30 +00:00
Switching from WAF scripts to identYwaf (avoiding redundant work from my side)
This commit is contained in:
@@ -904,42 +904,6 @@ def _setPreprocessFunctions():
|
||||
errMsg += "(Note: find template script at '%s')" % filename
|
||||
raise SqlmapGenericException(errMsg)
|
||||
|
||||
def _setWafFunctions():
|
||||
"""
|
||||
Loads WAF/IPS detecting functions from script(s)
|
||||
"""
|
||||
|
||||
if conf.identifyWaf:
|
||||
for found in glob.glob(os.path.join(paths.SQLMAP_WAF_PATH, "*.py")):
|
||||
dirname, filename = os.path.split(found)
|
||||
dirname = os.path.abspath(dirname)
|
||||
|
||||
if filename == "__init__.py":
|
||||
continue
|
||||
|
||||
debugMsg = "loading WAF script '%s'" % filename[:-3]
|
||||
logger.debug(debugMsg)
|
||||
|
||||
if dirname not in sys.path:
|
||||
sys.path.insert(0, dirname)
|
||||
|
||||
try:
|
||||
if filename[:-3] in sys.modules:
|
||||
del sys.modules[filename[:-3]]
|
||||
module = __import__(safeFilepathEncode(filename[:-3]))
|
||||
except ImportError as ex:
|
||||
raise SqlmapSyntaxException("cannot import WAF script '%s' (%s)" % (getUnicode(filename[:-3]), getSafeExString(ex)))
|
||||
|
||||
_ = dict(inspect.getmembers(module))
|
||||
if "detect" not in _:
|
||||
errMsg = "missing function 'detect(get_page)' "
|
||||
errMsg += "in WAF script '%s'" % found
|
||||
raise SqlmapGenericException(errMsg)
|
||||
else:
|
||||
kb.wafFunctions.append((_["detect"], _.get("__product__", filename[:-3])))
|
||||
|
||||
kb.wafFunctions = sorted(kb.wafFunctions, key=lambda _: "generic" in _[1].lower())
|
||||
|
||||
def _setThreads():
|
||||
if not isinstance(conf.threads, int) or conf.threads <= 0:
|
||||
conf.threads = 1
|
||||
@@ -2394,10 +2358,6 @@ def _basicOptionValidation():
|
||||
errMsg = "option '-d' is incompatible with option '--dbms'"
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
if conf.identifyWaf and conf.skipWaf:
|
||||
errMsg = "switch '--identify-waf' is incompatible with switch '--skip-waf'"
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
|
||||
if conf.titles and conf.nullConnection:
|
||||
errMsg = "switch '--titles' is incompatible with switch '--null-connection'"
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
@@ -2630,7 +2590,6 @@ def init():
|
||||
_listTamperingFunctions()
|
||||
_setTamperingFunctions()
|
||||
_setPreprocessFunctions()
|
||||
_setWafFunctions()
|
||||
_setTrafficOutputFP()
|
||||
_setupHTTPCollector()
|
||||
_setHttpChunked()
|
||||
|
||||
@@ -229,7 +229,6 @@ optDict = {
|
||||
"dependencies": "boolean",
|
||||
"disableColoring": "boolean",
|
||||
"googlePage": "integer",
|
||||
"identifyWaf": "boolean",
|
||||
"listTampers": "boolean",
|
||||
"mobile": "boolean",
|
||||
"offline": "boolean",
|
||||
|
||||
@@ -28,7 +28,6 @@ from lib.core.common import shellExec
|
||||
from lib.core.convert import stdoutEncode
|
||||
from lib.core.option import _setHTTPHandlers
|
||||
from lib.core.option import setVerbosity
|
||||
from lib.core.option import _setWafFunctions
|
||||
from lib.core.settings import IS_WIN
|
||||
from thirdparty.six.moves import http_client as _http_client
|
||||
|
||||
@@ -70,7 +69,6 @@ def resolveCrossReferences():
|
||||
lib.request.connect.setHTTPHandlers = _setHTTPHandlers
|
||||
lib.utils.search.setHTTPHandlers = _setHTTPHandlers
|
||||
lib.controller.checks.setVerbosity = setVerbosity
|
||||
lib.controller.checks.setWafFunctions = _setWafFunctions
|
||||
lib.utils.sqlalchemy.getSafeExString = getSafeExString
|
||||
thirdparty.ansistrm.ansistrm.stdoutEncode = stdoutEncode
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.5.130"
|
||||
VERSION = "1.3.5.131"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
||||
Reference in New Issue
Block a user