mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-23 15:54:24 +03:00
added --text-only switch
This commit is contained in:
parent
47022071cb
commit
d2ec132469
|
@ -29,6 +29,7 @@ import time
|
|||
from difflib import SequenceMatcher
|
||||
|
||||
from lib.core.agent import agent
|
||||
from lib.core.common import getFilteredPageContent
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import preparePageForLineComparison
|
||||
from lib.core.common import randomInt
|
||||
|
@ -376,7 +377,7 @@ def checkConnection():
|
|||
|
||||
try:
|
||||
page, _ = Request.getPage()
|
||||
conf.seqMatcher.set_seq1(page)
|
||||
conf.seqMatcher.set_seq1(page if not conf.textOnly else getFilteredPageContent(page))
|
||||
|
||||
except sqlmapConnectionException, errMsg:
|
||||
errMsg = getUnicode(errMsg)
|
||||
|
|
|
@ -98,9 +98,6 @@ def start():
|
|||
if not conf.start:
|
||||
return False
|
||||
|
||||
if conf.optimize:
|
||||
conf.useCommonPrediction = conf.useNullConnection = conf.keepAlive = True
|
||||
|
||||
if conf.direct:
|
||||
initTargetEnv()
|
||||
setupTargetEnv()
|
||||
|
|
|
@ -938,6 +938,10 @@ def __cleanupOptions():
|
|||
if conf.googleDork or conf.list:
|
||||
conf.multipleTargets = True
|
||||
|
||||
if conf.optimize:
|
||||
conf.useCommonPrediction = conf.keepAlive = True
|
||||
conf.useNullConnection = not conf.textOnly
|
||||
|
||||
def __setConfAttributes():
|
||||
"""
|
||||
This function set some needed attributes into the configuration
|
||||
|
@ -1162,6 +1166,10 @@ def __basicOptionValidation():
|
|||
errMsg = "value for --ratio (matchRatio) option must be in range [0,1]"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
if conf.textOnly and conf.useNullConnection:
|
||||
errMsg = "switch --text-only is incompatible with switch --null-connection"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
def init(inputOptions=advancedDict()):
|
||||
"""
|
||||
Set attributes into both configuration and knowledge base singletons
|
||||
|
|
|
@ -193,6 +193,10 @@ def cmdLineParser():
|
|||
injection.add_option("--threshold", dest="thold", type="float",
|
||||
help="Page comparison threshold value (0.0-1.0)")
|
||||
|
||||
injection.add_option("--text-only", dest="textOnly",
|
||||
action="store_true", default=False,
|
||||
help="Compare pages based only on their textual content")
|
||||
|
||||
injection.add_option("--space", dest="space",
|
||||
help="Use defined string for space instead of standard ' '")
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
import re
|
||||
|
||||
from lib.core.common import getFilteredPageContent
|
||||
from lib.core.common import preparePageForLineComparison
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
|
@ -84,7 +85,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
|||
if ratio > 1.:
|
||||
ratio = 1. / ratio
|
||||
else:
|
||||
conf.seqMatcher.set_seq2(page)
|
||||
conf.seqMatcher.set_seq2(page if not conf.textOnly else getFilteredPageContent(page))
|
||||
ratio = round(conf.seqMatcher.ratio(), 3)
|
||||
|
||||
if conf.seqLock:
|
||||
|
|
Loading…
Reference in New Issue
Block a user