(message, default=None, checkBatch=True)
return retVal
Reads input from terminal
Reads input from terminal
Reads input from terminal
def readInput(message, default=None, checkBatch=True):
    """
    Reads input from terminal
    """

    retVal = None
    kb.stickyLevel = None

    message = getUnicode(message)

    if "\n" in message:
        message += "%s> " % ("\n" if message.count("\n") > 1 else "")
    elif message[-1] == ']':
        message += " "

    if kb.get("prependFlag"):
        message = "\n%s" % message
        kb.prependFlag = False

    if conf.get("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)
            elif answer is None and retVal:
                retVal = "%s,%s" % (retVal, getUnicode(item, UNICODE_ENCODING))

    if retVal:
        infoMsg = "%s%s" % (message, retVal)
        logger.info(infoMsg)

        debugMsg = "used the given answer"
        logger.debug(debugMsg)

    if retVal is None:
        if checkBatch and conf.get("batch"):
            if isListLike(default):
                options = ",".join(getUnicode(opt, UNICODE_ENCODING) for opt in default)
            elif default:
                options = getUnicode(default, UNICODE_ENCODING)
            else:
                options = unicode()

            dataToStdout("\r%s%s\n" % (message, options), forceOutput=True, bold=True)

            debugMsg = "used the default behaviour, running in batch mode"
            logger.debug(debugMsg)

            retVal = default
        else:
            logging._acquireLock()

            if conf.get("beep"):
                beep()

            dataToStdout("\r%s" % message, forceOutput=True, bold=True)
            kb.prependFlag = False

            try:
                retVal = raw_input() or default
                retVal = getUnicode(retVal, encoding=sys.stdin.encoding) if retVal else retVal
            except:
                time.sleep(0.05)  # Reference: http://www.gossamer-threads.com/lists/python/python/781893
                kb.prependFlag = True
                raise SqlmapUserQuitException

            finally:
                logging._releaseLock()

    return retVal
def readInput ( message , default = None , checkBatch = True ) : retVal = None kb . stickyLevel = None message = getUnicode ( message ) if "\n" in message : message += "%s> " % ( "\n" if message . count ( "\n" ) > 1 else "" ) elif message [ - 1 ] == ']' : message += " " if kb . get ( "prependFlag" ) : message = "\n%s" % message kb . prependFlag = False if conf . get ( "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 ) elif answer is None and retVal : retVal = "%s,%s" % ( retVal , getUnicode ( item , UNICODE_ENCODING ) ) if retVal : infoMsg = "%s%s" % ( message , retVal ) logger . info ( infoMsg ) debugMsg = "used the given answer" logger . debug ( debugMsg ) if retVal is None : if checkBatch and conf . get ( "batch" ) : if isListLike ( default ) : options = "," . join ( getUnicode ( opt , UNICODE_ENCODING ) for opt in default ) elif default : options = getUnicode ( default , UNICODE_ENCODING ) else : options = unicode ( ) dataToStdout ( "\r%s%s\n" % ( message , options ) , forceOutput = True , bold = True ) debugMsg = "used the default behaviour, running in batch mode" logger . debug ( debugMsg ) retVal = default else : logging . _acquireLock ( ) if conf . get ( "beep" ) : beep ( ) dataToStdout ( "\r%s" % message , forceOutput = True , bold = True ) kb . prependFlag = False try : retVal = raw_input ( ) or default retVal = getUnicode ( retVal , encoding = sys . stdin . encoding ) if retVal else retVal except : time . sleep ( 0.05 ) # Reference: http://www.gossamer-threads.com/lists/python/python/781893 kb . prependFlag = True raise SqlmapUserQuitException finally : logging . _releaseLock ( ) return retVal