3636from lib .core .common import showStaticWords
3737from lib .core .common import singleTimeLogMessage
3838from lib .core .common import singleTimeWarnMessage
39+ from lib .core .common import urlencode
3940from lib .core .common import wasLastResponseDBMSError
4041from lib .core .common import wasLastResponseHTTPError
4142from lib .core .data import conf
4243from lib .core .data import kb
4344from lib .core .data import logger
4445from lib .core .datatype import AttribDict
4546from lib .core .datatype import InjectionDict
47+ from lib .core .decorators import cachedmethod
4648from lib .core .dicts import FROM_DUMMY_TABLE
4749from lib .core .enums import DBMS
4850from lib .core .enums import HEURISTIC_TEST
@@ -1045,15 +1047,26 @@ def identifyWaf():
10451047 infoMsg += "backend WAF/IPS/IDS protection"
10461048 logger .info (infoMsg )
10471049
1050+ @cachedmethod
1051+ def _ (* args , ** kwargs ):
1052+ try :
1053+ if kwargs .get ("get" ):
1054+ kwargs ["get" ] = urlencode (kwargs ["get" ])
1055+ kwargs ["raise404" ] = False
1056+ return Request .getPage (* args , ** kwargs )
1057+ except Exception , ex :
1058+ return None , None , None
1059+
10481060 retVal = False
1049- page , headers , code = Request .getPage ()
10501061
10511062 for function , product , request in kb .wafFunctions :
10521063 found = False
1064+
10531065 if not request :
1054- found = function (page or "" , headers or {}, code )
1066+ found = function (_ )
10551067 else :
10561068 pass
1069+
10571070 if found :
10581071 retVal = product
10591072 break
@@ -1063,7 +1076,7 @@ def identifyWaf():
10631076 warnMsg += "consider usage of tamper scripts (option '--tamper')"
10641077 logger .critical (warnMsg )
10651078 else :
1066- warnMsg = "no WAF/IDS/IPS were identified"
1079+ warnMsg = "WAF/IDS/IPS product not identified"
10671080 logger .warn (warnMsg )
10681081
10691082 return retVal
0 commit comments