MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / dataToStdout

Function dataToStdout

lib/core/common.py:1026–1061  ·  view source on GitHub ↗

Writes text to the stdout (console) stream

(data, forceOutput=False, bold=False, contentType=None, status=CONTENT_STATUS.IN_PROGRESS, coloring=True)

Source from the content-addressed store, hash-verified

1024 return retVal
1025
1026def dataToStdout(data, forceOutput=False, bold=False, contentType=None, status=CONTENT_STATUS.IN_PROGRESS, coloring=True):
1027 """
1028 Writes text to the stdout (console) stream
1029 """
1030
1031 if not IS_TTY and isinstance(data, six.string_types) and data.startswith("\r"):
1032 if re.search(r"\(\d+%\)", data):
1033 data = ""
1034 else:
1035 data = "\n%s" % data.strip("\r")
1036
1037 if not kb.get("threadException"):
1038 if forceOutput or not (getCurrentThreadData().disableStdOut or kb.get("wizardMode")):
1039 multiThreadMode = kb.get("multiThreadMode")
1040 if multiThreadMode:
1041 logging._acquireLock()
1042
1043 try:
1044 if conf.get("api"):
1045 sys.stdout.write(stdoutEncode(clearColors(data)), status, contentType)
1046 else:
1047 sys.stdout.write(stdoutEncode(setColor(data, bold=bold) if coloring else clearColors(data)))
1048 except IOError:
1049 pass
1050 except UnicodeEncodeError:
1051 sys.stdout.write(re.sub(r"[^ -~]", '?', clearColors(data)))
1052 finally:
1053 try:
1054 sys.stdout.flush()
1055 except IOError:
1056 raise SystemExit
1057
1058 if multiThreadMode:
1059 logging._releaseLock()
1060
1061 kb.prependFlag = isinstance(data, six.string_types) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
1062
1063def dataToTrafficFile(data):
1064 if not conf.trafficFile:

Callers 15

mainFunction · 0.90
_bruteProcessVariantAFunction · 0.90
_bruteProcessVariantBFunction · 0.90
drawMethod · 0.90
crawlThreadFunction · 0.90
clientFunction · 0.90
tableExistsThreadFunction · 0.90
tableExistsFunction · 0.90
columnExistsThreadFunction · 0.90
columnExistsFunction · 0.90
fileExistsThreadFunction · 0.90
fileExistsFunction · 0.90

Calls 8

getCurrentThreadDataFunction · 0.90
stdoutEncodeFunction · 0.90
clearColorsFunction · 0.85
setColorFunction · 0.85
searchMethod · 0.45
getMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45

Tested by 2

vulnTestFunction · 0.72
smokeTestFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…