77
88import copy
99import logging
10- import os
1110import random
1211import re
1312import socket
1413import subprocess
1514import sys
16- import tempfile
1715import time
1816
1917from extra .beep .beep import beep
3331from lib .core .common import hashDBWrite
3432from lib .core .common import intersect
3533from lib .core .common import listToStrValue
36- from lib .core .common import openFile
3734from lib .core .common import parseFilePaths
3835from lib .core .common import popValue
3936from lib .core .common import pushValue
4441from lib .core .common import singleTimeLogMessage
4542from lib .core .common import singleTimeWarnMessage
4643from lib .core .common import unArrayizeValue
47- from lib .core .common import urlencode
4844from lib .core .common import wasLastResponseDBMSError
4945from lib .core .common import wasLastResponseHTTPError
5046from lib .core .compat import xrange
5147from lib .core .convert import getUnicode
52- from lib .core .defaults import defaults
5348from lib .core .data import conf
5449from lib .core .data import kb
5550from lib .core .data import logger
5651from lib .core .datatype import AttribDict
5752from lib .core .datatype import InjectionDict
58- from lib .core .decorators import cachedmethod
5953from lib .core .decorators import stackedmethod
6054from lib .core .dicts import FROM_DUMMY_TABLE
6155from lib .core .enums import DBMS
6256from lib .core .enums import HASHDB_KEYS
6357from lib .core .enums import HEURISTIC_TEST
6458from lib .core .enums import HTTP_HEADER
6559from lib .core .enums import HTTPMETHOD
66- from lib .core .enums import MKSTEMP_PREFIX
6760from lib .core .enums import NOTE
6861from lib .core .enums import NULLCONNECTION
6962from lib .core .enums import PAYLOAD
8174from lib .core .settings import CHECK_INTERNET_ADDRESS
8275from lib .core .settings import CHECK_INTERNET_VALUE
8376from lib .core .settings import DEFAULT_GET_POST_DELIMITER
84- from lib .core .settings import DEV_EMAIL_ADDRESS
8577from lib .core .settings import DUMMY_NON_SQLI_CHECK_APPENDIX
8678from lib .core .settings import FI_ERROR_REGEX
8779from lib .core .settings import FORMAT_EXCEPTION_STRINGS
@@ -1387,6 +1379,7 @@ def checkWaf():
13871379 pushValue (kb .resendPostOnRedirect )
13881380 pushValue (conf .timeout )
13891381
1382+ kb .identYwaf = True
13901383 kb .redirectChoice = REDIRECTION .YES
13911384 kb .resendPostOnRedirect = False
13921385 conf .timeout = IDS_WAF_CHECK_TIMEOUT
@@ -1396,30 +1389,31 @@ def checkWaf():
13961389 except SqlmapConnectionException :
13971390 retVal = True
13981391 finally :
1392+ kb .identYwaf = False
13991393 kb .matchRatio = None
14001394
14011395 conf .timeout = popValue ()
14021396 kb .resendPostOnRedirect = popValue ()
14031397 kb .redirectChoice = popValue ()
14041398
1399+ hashDBWrite (HASHDB_KEYS .CHECK_WAF_RESULT , retVal , True )
1400+
14051401 if retVal :
14061402 if not kb .identifiedWafs :
14071403 warnMsg = "heuristics detected that the target "
14081404 warnMsg += "is protected by some kind of WAF/IPS"
14091405 logger .critical (warnMsg )
14101406
14111407 message = "are you sure that you want to "
1412- message += "continue with further target testing? [y/N] "
1413- choice = readInput (message , default = 'N' , boolean = True )
1414-
1415- if not conf .tamper :
1416- warnMsg = "please consider usage of tamper scripts (option '--tamper')"
1417- singleTimeWarnMessage (warnMsg )
1408+ message += "continue with further target testing? [Y/n] "
1409+ choice = readInput (message , default = 'Y' , boolean = True )
14181410
14191411 if not choice :
14201412 raise SqlmapUserQuitException
1421-
1422- hashDBWrite (HASHDB_KEYS .CHECK_WAF_RESULT , retVal , True )
1413+ else :
1414+ if not conf .tamper :
1415+ warnMsg = "please consider usage of tamper scripts (option '--tamper')"
1416+ singleTimeWarnMessage (warnMsg )
14231417
14241418 return retVal
14251419
0 commit comments