mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-04 20:03:10 +03:00
Implementation for an Issue #253
This commit is contained in:
parent
c40dded28c
commit
ef2038f1c8
|
@ -759,6 +759,7 @@ def readInput(message, default=None, checkBatch=True):
|
||||||
Reads input from terminal
|
Reads input from terminal
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
retVal = None
|
||||||
kb.stickyLevel = None
|
kb.stickyLevel = None
|
||||||
|
|
||||||
if "\n" in message:
|
if "\n" in message:
|
||||||
|
@ -766,6 +767,22 @@ def readInput(message, default=None, checkBatch=True):
|
||||||
elif message[-1] == ']':
|
elif message[-1] == ']':
|
||||||
message += " "
|
message += " "
|
||||||
|
|
||||||
|
if conf.answers:
|
||||||
|
for item in conf.answers.split(','):
|
||||||
|
question = item.split('=')[0].strip()
|
||||||
|
answer = item.split('=')[1] if len(item.split('=')) > 1 else None
|
||||||
|
if answer and question.lower() in message.lower():
|
||||||
|
retVal = getUnicode(answer, UNICODE_ENCODING)
|
||||||
|
|
||||||
|
infoMsg = "%s%s" % (getUnicode(message), retVal)
|
||||||
|
logger.info(infoMsg)
|
||||||
|
|
||||||
|
debugMsg = "used the given answer"
|
||||||
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
if retVal is None:
|
||||||
if checkBatch and conf.batch:
|
if checkBatch and conf.batch:
|
||||||
if isListLike(default):
|
if isListLike(default):
|
||||||
options = ",".join(getUnicode(opt, UNICODE_ENCODING) for opt in default)
|
options = ",".join(getUnicode(opt, UNICODE_ENCODING) for opt in default)
|
||||||
|
@ -780,14 +797,14 @@ def readInput(message, default=None, checkBatch=True):
|
||||||
debugMsg = "used the default behaviour, running in batch mode"
|
debugMsg = "used the default behaviour, running in batch mode"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
data = default
|
retVal = default
|
||||||
else:
|
else:
|
||||||
logging._acquireLock()
|
logging._acquireLock()
|
||||||
dataToStdout("\r%s" % message, forceOutput=True, bold=True)
|
dataToStdout("\r%s" % message, forceOutput=True, bold=True)
|
||||||
kb.prependFlag = False
|
kb.prependFlag = False
|
||||||
try:
|
try:
|
||||||
data = raw_input() or default
|
retVal = raw_input() or default
|
||||||
data = getUnicode(data, system=True) if data else data
|
retVal = getUnicode(retVal, system=True) if retVal else retVal
|
||||||
except:
|
except:
|
||||||
time.sleep(0.05) # Reference: http://www.gossamer-threads.com/lists/python/python/781893
|
time.sleep(0.05) # Reference: http://www.gossamer-threads.com/lists/python/python/781893
|
||||||
kb.prependFlag = True
|
kb.prependFlag = True
|
||||||
|
@ -795,7 +812,7 @@ def readInput(message, default=None, checkBatch=True):
|
||||||
finally:
|
finally:
|
||||||
logging._releaseLock()
|
logging._releaseLock()
|
||||||
|
|
||||||
return data
|
return retVal
|
||||||
|
|
||||||
def randomRange(start=0, stop=1000):
|
def randomRange(start=0, stop=1000):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -190,6 +190,8 @@ optDict = {
|
||||||
},
|
},
|
||||||
|
|
||||||
"Miscellaneous": {
|
"Miscellaneous": {
|
||||||
|
"mnemonics": "string",
|
||||||
|
"answers": "string",
|
||||||
"checkPayload": "boolean",
|
"checkPayload": "boolean",
|
||||||
"cleanup": "boolean",
|
"cleanup": "boolean",
|
||||||
"dependencies": "boolean",
|
"dependencies": "boolean",
|
||||||
|
|
|
@ -604,6 +604,9 @@ def cmdLineParser():
|
||||||
miscellaneous.add_option("-z", dest="mnemonics",
|
miscellaneous.add_option("-z", dest="mnemonics",
|
||||||
help="Use short mnemonics (e.g. \"flu,bat,ban,tec=EU\")")
|
help="Use short mnemonics (e.g. \"flu,bat,ban,tec=EU\")")
|
||||||
|
|
||||||
|
miscellaneous.add_option("--answers", dest="answers",
|
||||||
|
help="Set question answers (e.g. \"quit=N,follow=N\")")
|
||||||
|
|
||||||
miscellaneous.add_option("--check-payload", dest="checkPayload",
|
miscellaneous.add_option("--check-payload", dest="checkPayload",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Offline WAF/IPS/IDS payload detection testing")
|
help="Offline WAF/IPS/IDS payload detection testing")
|
||||||
|
|
|
@ -650,6 +650,12 @@ updateAll = False
|
||||||
|
|
||||||
[Miscellaneous]
|
[Miscellaneous]
|
||||||
|
|
||||||
|
# Use short mnemonics (e.g. "flu,bat,ban,tec=EU")
|
||||||
|
mnemonics =
|
||||||
|
|
||||||
|
# Set question answers (e.g. "quit=N,follow=N")
|
||||||
|
answers =
|
||||||
|
|
||||||
# Offline WAF/IPS/IDS payload detection testing.
|
# Offline WAF/IPS/IDS payload detection testing.
|
||||||
checkPayload = False
|
checkPayload = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user