got rid of unnecessary output for API - #297

This commit is contained in:
Bernardo Damele 2013-02-05 15:00:06 +00:00
parent 4428ad5345
commit e03010f48b
2 changed files with 7 additions and 7 deletions

View File

@ -156,7 +156,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
warnMsg += "usage of option '--threads' for faster data retrieval" warnMsg += "usage of option '--threads' for faster data retrieval"
singleTimeWarnMessage(warnMsg) singleTimeWarnMessage(warnMsg)
if conf.verbose in (1, 2) and not showEta: if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
if isinstance(length, int) and conf.threads > 1: if isinstance(length, int) and conf.threads > 1:
dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, conf.progressWidth))) dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, conf.progressWidth)))
dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X")) dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X"))
@ -430,7 +430,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
if (endCharIndex - startCharIndex == conf.progressWidth) and (endCharIndex < length - 1): if (endCharIndex - startCharIndex == conf.progressWidth) and (endCharIndex < length - 1):
output = output[:-2] + '..' output = output[:-2] + '..'
if conf.verbose in (1, 2) and not showEta: if conf.verbose in (1, 2) and not showEta and not hasattr(conf, "api"):
_ = count - firstChar _ = count - firstChar
output += '_' * (min(length, conf.progressWidth) - len(output)) output += '_' * (min(length, conf.progressWidth) - len(output))
status = ' %d/%d (%d%%)' % (_, length, round(100.0 * _ / length)) status = ' %d/%d (%d%%)' % (_, length, round(100.0 * _ / length))
@ -460,7 +460,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
finalValue = "".join(value) finalValue = "".join(value)
infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue)) infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue))
if conf.verbose in (1, 2) and not showEta and infoMsg: if conf.verbose in (1, 2) and not showEta and infoMsg and not hasattr(conf, "api"):
dataToStdout(infoMsg) dataToStdout(infoMsg)
# No multi-threading (--threads = 1) # No multi-threading (--threads = 1)
@ -566,11 +566,11 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
elif partialValue: elif partialValue:
hashDBWrite(expression, "%s%s" % (PARTIAL_VALUE_MARKER if not conf.hexConvert else PARTIAL_HEX_VALUE_MARKER, partialValue)) hashDBWrite(expression, "%s%s" % (PARTIAL_VALUE_MARKER if not conf.hexConvert else PARTIAL_HEX_VALUE_MARKER, partialValue))
if conf.hexConvert and not abortedFlag: if conf.hexConvert and not abortedFlag and not hasattr(conf, "api"):
infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * retrievedLength) infoMsg = "\r[%s] [INFO] retrieved: %s %s\n" % (time.strftime("%X"), filterControlChars(finalValue), " " * retrievedLength)
dataToStdout(infoMsg) dataToStdout(infoMsg)
else: else:
if conf.verbose in (1, 2) or showEta: if conf.verbose in (1, 2) or showEta and not hasattr(conf, "api"):
dataToStdout("\n") dataToStdout("\n")
if (conf.verbose in (1, 2) and showEta) or conf.verbose >= 3: if (conf.verbose in (1, 2) and showEta) or conf.verbose >= 3:

View File

@ -99,7 +99,7 @@ def tableExists(tableFile, regex=None):
threadData.shared.value.append(table) threadData.shared.value.append(table)
threadData.shared.unique.add(table.lower()) threadData.shared.unique.add(table.lower())
if conf.verbose in (1, 2): if conf.verbose in (1, 2) and not hasattr(conf, "api"):
clearConsoleLine(True) clearConsoleLine(True)
infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), table) infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), table)
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)
@ -195,7 +195,7 @@ def columnExists(columnFile, regex=None):
if result: if result:
threadData.shared.value.append(column) threadData.shared.value.append(column)
if conf.verbose in (1, 2): if conf.verbose in (1, 2) and not hasattr(conf, "api"):
clearConsoleLine(True) clearConsoleLine(True)
infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), column) infoMsg = "[%s] [INFO] retrieved: %s\r\n" % (time.strftime("%X"), column)
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)