Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6700cab

Browse files
committed
minor optimization
1 parent d1f5c1d commit 6700cab

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

lib/controller/checks.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from lib.core.session import setString
4949
from lib.core.session import setRegexp
5050
from lib.core.settings import DYNAMICITY_MARK_LENGTH
51+
from lib.core.settings import UPPER_RATIO_BOUND
5152
from lib.core.unescaper import unescaper
5253
from lib.request.connect import Connect as Request
5354
from lib.request.templates import getPageTemplate
@@ -636,24 +637,29 @@ def checkStability():
636637
errMsg = "Empty value supplied"
637638
raise sqlmapNoneDataException, errMsg
638639
else:
639-
checkDynamicContent(firstPage, secondPage)
640+
conf.seqMatcher.set_seq1(firstPage)
641+
conf.seqMatcher.set_seq2(secondPage)
640642

641-
count = 0
642-
while not Request.queryPage():
643-
count += 1
643+
# In case of an intolerable difference turn on dynamicity removal engine
644+
if conf.seqMatcher.quick_ratio() <= UPPER_RATIO_BOUND:
645+
checkDynamicContent(firstPage, secondPage)
644646

645-
if count > conf.retries:
646-
errMsg = "target url is too dynamic. unable to continue. "
647-
errMsg += "consider using other switches (e.g. "
648-
errMsg += "--longest-common, --string, --text-only, etc.)"
649-
raise sqlmapSiteTooDynamic, errMsg
647+
count = 0
648+
while not Request.queryPage():
649+
count += 1
650650

651-
warnMsg = "target url is heavily dynamic"
652-
warnMsg += ", sqlmap is going to retry the request"
653-
logger.critical(warnMsg)
651+
if count > conf.retries:
652+
errMsg = "target url is too dynamic. unable to continue. "
653+
errMsg += "consider using other switches (e.g. "
654+
errMsg += "--longest-common, --string, --text-only, etc.)"
655+
raise sqlmapSiteTooDynamic, errMsg
654656

655-
secondPage, _ = Request.queryPage(content=True)
656-
checkDynamicContent(firstPage, secondPage)
657+
warnMsg = "target url is heavily dynamic"
658+
warnMsg += ", sqlmap is going to retry the request"
659+
logger.critical(warnMsg)
660+
661+
secondPage, _ = Request.queryPage(content=True)
662+
checkDynamicContent(firstPage, secondPage)
657663

658664
return kb.pageStable
659665

0 commit comments

Comments
 (0)