Update regarding #3466

This commit is contained in:
Miroslav Stampar
2019-02-04 15:49:13 +01:00
parent 82aa481e06
commit bd74a201d5
4 changed files with 35 additions and 16 deletions

View File

@@ -3535,6 +3535,32 @@ def intersect(containerA, containerB, lowerCase=False):
return retVal
def decodeStringEscape(value):
"""
Decodes escaped string values (e.g. "\\t" -> "\t")
"""
retVal = value
if value and '\\' in value:
if isinstance(value, unicode):
retVal = retVal.encode(UNICODE_ENCODING)
try:
retVal = codecs.escape_decode(retVal)[0]
except:
try:
retVal = retVal.decode("string_escape")
except:
charset = string.whitespace.replace(" ", "")
for _ in charset:
retVal = retVal.replace(repr(_).strip("'"), _)
if isinstance(value, unicode):
retVal = getUnicode(retVal)
return retVal
def removeReflectiveValues(content, payload, suppressWarning=False):
"""
Neutralizes reflective values in a given content based on a payload

View File

@@ -33,6 +33,7 @@ from lib.core.common import Backend
from lib.core.common import boldifyMessage
from lib.core.common import checkFile
from lib.core.common import dataToStdout
from lib.core.common import decodeStringEscape
from lib.core.common import getPublicTypeMembers
from lib.core.common import getSafeExString
from lib.core.common import findLocalPort
@@ -1500,11 +1501,8 @@ def _cleanupOptions():
else:
conf.rParam = []
if conf.paramDel and '\\' in conf.paramDel:
try:
conf.paramDel = conf.paramDel.decode("string_escape")
except ValueError:
pass
if conf.paramDel:
conf.paramDel = decodeStringEscape(conf.paramDel)
if conf.skip:
conf.skip = conf.skip.replace(" ", "")
@@ -1616,7 +1614,7 @@ def _cleanupOptions():
conf.code = int(conf.code)
if conf.csvDel:
conf.csvDel = conf.csvDel.decode("string_escape") # e.g. '\\t' -> '\t'
conf.csvDel = decodeStringEscape(conf.csvDel)
if conf.torPort and isinstance(conf.torPort, basestring) and conf.torPort.isdigit():
conf.torPort = int(conf.torPort)
@@ -1629,12 +1627,7 @@ def _cleanupOptions():
setPaths(paths.SQLMAP_ROOT_PATH)
if conf.string:
try:
conf.string = conf.string.decode("unicode_escape")
except:
charset = string.whitespace.replace(" ", "")
for _ in charset:
conf.string = conf.string.replace(_.encode("string_escape"), _)
conf.string = decodeStringEscape(conf.string)
if conf.getAll:
map(lambda _: conf.__setitem__(_, True), WIZARD.ALL)

View File

@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.1.83"
VERSION = "1.3.2.0"
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)