Patch related to the #3453

This commit is contained in:
Miroslav Stampar 2019-05-21 14:18:14 +02:00
parent ea4052ec65
commit 688150cf6c
4 changed files with 23 additions and 2 deletions

View File

@ -101,11 +101,29 @@ def filterNone(values): # Cross-referenced function
def isListLike(value): # Cross-referenced function
raise NotImplementedError
def shellExec(cmd): # Cross-referenced function
raise NotImplementedError
def stdoutEncode(value):
value = value or ""
if IS_WIN and kb.get("codePage", -1) is None:
output = shellExec("chcp")
match = re.search(r": (\d{3,})", output or "")
if match:
try:
candidate = "cp%s" % match.group(1)
codecs.lookup(candidate)
except LookupError:
pass
else:
kb.codePage = candidate
kb.codePage = kb.codePage or ""
if isinstance(value, six.text_type) and PYVERSION < "3.6":
encoding = sys.stdout.encoding or UNICODE_ENCODING
encoding = kb.get("codePage") or sys.stdout.encoding or UNICODE_ENCODING
while True:
try:

View File

@ -1872,6 +1872,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.chars.stop = "%s%s%s" % (KB_CHARS_BOUNDARY_CHAR, randomStr(length=3, alphabet=KB_CHARS_LOW_FREQUENCY_ALPHABET), KB_CHARS_BOUNDARY_CHAR)
kb.chars.at, kb.chars.space, kb.chars.dollar, kb.chars.hash_ = ("%s%s%s" % (KB_CHARS_BOUNDARY_CHAR, _, KB_CHARS_BOUNDARY_CHAR) for _ in randomStr(length=4, lowercase=True))
kb.codePage = None
kb.columnExistsChoice = None
kb.commonOutputs = None
kb.connErrorChoice = None

View File

@ -24,6 +24,7 @@ from lib.core.common import getSafeExString
from lib.core.common import isListLike
from lib.core.common import singleTimeWarnMessage
from lib.core.common import readInput
from lib.core.common import shellExec
from lib.core.convert import stdoutEncode
from lib.core.option import _setHTTPHandlers
from lib.core.option import setVerbosity
@ -63,6 +64,7 @@ def resolveCrossReferences():
lib.core.common.getPageTemplate = getPageTemplate
lib.core.convert.filterNone = filterNone
lib.core.convert.isListLike = isListLike
lib.core.convert.shellExec = shellExec
lib.core.convert.singleTimeWarnMessage = singleTimeWarnMessage
lib.core.option._pympTempLeakPatch = pympTempLeakPatch
lib.request.connect.setHTTPHandlers = _setHTTPHandlers

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.5.123"
VERSION = "1.3.5.124"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)