mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
Minor bug fix and layout adjustment regarding --threading and standard output
This commit is contained in:
parent
9e8a108768
commit
f9a135e232
|
@ -500,9 +500,13 @@ def checkFile(filename):
|
|||
|
||||
if not os.path.exists(filename):
|
||||
raise sqlmapFilePathException, "unable to read file '%s'" % filename
|
||||
|
||||
def replaceNewlineTabs(inpStr):
|
||||
replacedString = inpStr.replace("\n", "__NEWLINE__").replace("\t", "__TAB__")
|
||||
|
||||
def replaceNewlineTabs(inpStr, stdout=False):
|
||||
if stdout:
|
||||
replacedString = inpStr.replace("\n", " ").replace("\t", " ")
|
||||
else:
|
||||
replacedString = inpStr.replace("\n", "__NEWLINE__").replace("\t", "__TAB__")
|
||||
|
||||
replacedString = replacedString.replace(temp.delimiter, "__DEL__")
|
||||
|
||||
return replacedString
|
||||
|
|
|
@ -70,7 +70,7 @@ class Dump:
|
|||
data = data.replace("__DEL__", ", ")
|
||||
|
||||
if "\n" in data:
|
||||
self.__write("%s:\n---\n%s---\n" % (header, data))
|
||||
self.__write("%s:\n---\n%s\n---\n" % (header, data))
|
||||
else:
|
||||
self.__write("%s: '%s'\n" % (header, data))
|
||||
else:
|
||||
|
|
|
@ -204,17 +204,22 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
count = 0
|
||||
for i in xrange(startCharIndex, endCharIndex):
|
||||
output += '_' if value[i] is None else value[i]
|
||||
|
||||
for i in xrange(length):
|
||||
count += 1 if value[i] is not None else 0
|
||||
|
||||
if startCharIndex > 0:
|
||||
output = '..' + output[2:]
|
||||
|
||||
if endCharIndex - startCharIndex == conf.progressWidth:
|
||||
output = output[:-2] + '..'
|
||||
|
||||
output += '_' * (min(length, conf.progressWidth) - len(output))
|
||||
status = ' %d/%d (%d%s)' % (count, length, round(100.0*count/length), '%')
|
||||
output += status if count != length else " "*len(status)
|
||||
|
||||
iolock.acquire()
|
||||
dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), output))
|
||||
dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), replaceNewlineTabs(output, stdout=True)))
|
||||
iolock.release()
|
||||
|
||||
except (sqlmapConnectionException, sqlmapValueException), errMsg:
|
||||
|
|
|
@ -27,6 +27,7 @@ import re
|
|||
from lib.core.common import dataToSessionFile
|
||||
from lib.core.common import safeStringFormat
|
||||
from lib.core.common import randomStr
|
||||
from lib.core.common import replaceNewlineTabs
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
|
@ -113,6 +114,8 @@ def resume(expression, payload):
|
|||
if not resumedValue:
|
||||
return None
|
||||
|
||||
resumedValue = resumedValue.replace("__NEWLINE__", "\n").replace("__TAB__", "\t")
|
||||
|
||||
if resumedValue[-1] == "]":
|
||||
resumedValue = resumedValue[:-1]
|
||||
|
||||
|
@ -154,7 +157,7 @@ def resume(expression, payload):
|
|||
infoMsg += "%s" % resumedValue.split("\n")[0]
|
||||
logger.info(infoMsg)
|
||||
|
||||
dataToSessionFile("[%s][%s][%s][%s][%s]\n" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], expression, resumedValue))
|
||||
dataToSessionFile("[%s][%s][%s][%s][%s]\n" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], expression, replaceNewlineTabs(resumedValue)))
|
||||
|
||||
return resumedValue
|
||||
elif len(resumedValue) < int(length):
|
||||
|
@ -162,7 +165,7 @@ def resume(expression, payload):
|
|||
infoMsg += "%s..." % resumedValue.split("\n")[0]
|
||||
logger.info(infoMsg)
|
||||
|
||||
dataToSessionFile("[%s][%s][%s][%s][%s" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], expression, resumedValue))
|
||||
dataToSessionFile("[%s][%s][%s][%s][%s" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], expression, replaceNewlineTabs(resumedValue)))
|
||||
|
||||
if select:
|
||||
newExpr = expression.replace(regExpr, safeStringFormat(substringQuery, (regExpr, len(resumedValue) + 1, int(length))), 1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user