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

Skip to content

Commit d2ec132

Browse files
committed
added --text-only switch
1 parent 4702207 commit d2ec132

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

lib/controller/checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from difflib import SequenceMatcher
3030

3131
from lib.core.agent import agent
32+
from lib.core.common import getFilteredPageContent
3233
from lib.core.common import getUnicode
3334
from lib.core.common import preparePageForLineComparison
3435
from lib.core.common import randomInt
@@ -376,7 +377,7 @@ def checkConnection():
376377

377378
try:
378379
page, _ = Request.getPage()
379-
conf.seqMatcher.set_seq1(page)
380+
conf.seqMatcher.set_seq1(page if not conf.textOnly else getFilteredPageContent(page))
380381

381382
except sqlmapConnectionException, errMsg:
382383
errMsg = getUnicode(errMsg)

lib/controller/controller.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ def start():
9898
if not conf.start:
9999
return False
100100

101-
if conf.optimize:
102-
conf.useCommonPrediction = conf.useNullConnection = conf.keepAlive = True
103-
104101
if conf.direct:
105102
initTargetEnv()
106103
setupTargetEnv()

lib/core/option.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,10 @@ def __cleanupOptions():
938938
if conf.googleDork or conf.list:
939939
conf.multipleTargets = True
940940

941+
if conf.optimize:
942+
conf.useCommonPrediction = conf.keepAlive = True
943+
conf.useNullConnection = not conf.textOnly
944+
941945
def __setConfAttributes():
942946
"""
943947
This function set some needed attributes into the configuration
@@ -1162,6 +1166,10 @@ def __basicOptionValidation():
11621166
errMsg = "value for --ratio (matchRatio) option must be in range [0,1]"
11631167
raise sqlmapSyntaxException, errMsg
11641168

1169+
if conf.textOnly and conf.useNullConnection:
1170+
errMsg = "switch --text-only is incompatible with switch --null-connection"
1171+
raise sqlmapSyntaxException, errMsg
1172+
11651173
def init(inputOptions=advancedDict()):
11661174
"""
11671175
Set attributes into both configuration and knowledge base singletons

lib/parse/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ def cmdLineParser():
193193
injection.add_option("--threshold", dest="thold", type="float",
194194
help="Page comparison threshold value (0.0-1.0)")
195195

196+
injection.add_option("--text-only", dest="textOnly",
197+
action="store_true", default=False,
198+
help="Compare pages based only on their textual content")
199+
196200
injection.add_option("--space", dest="space",
197201
help="Use defined string for space instead of standard ' '")
198202

lib/request/comparison.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import re
2626

27+
from lib.core.common import getFilteredPageContent
2728
from lib.core.common import preparePageForLineComparison
2829
from lib.core.data import conf
2930
from lib.core.data import kb
@@ -84,7 +85,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
8485
if ratio > 1.:
8586
ratio = 1. / ratio
8687
else:
87-
conf.seqMatcher.set_seq2(page)
88+
conf.seqMatcher.set_seq2(page if not conf.textOnly else getFilteredPageContent(page))
8889
ratio = round(conf.seqMatcher.ratio(), 3)
8990

9091
if conf.seqLock:

0 commit comments

Comments
 (0)