Skip to content

Commit 20d875a

Browse files
committed
Fixes #4020
1 parent f947c5f commit 20d875a

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lib/controller/checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from lib.core.common import wasLastResponseDBMSError
4646
from lib.core.common import wasLastResponseHTTPError
4747
from lib.core.compat import xrange
48+
from lib.core.convert import getBytes
4849
from lib.core.convert import getUnicode
4950
from lib.core.data import conf
5051
from lib.core.data import kb
@@ -788,7 +789,7 @@ def genCmpPayload():
788789
logger.info(infoMsg)
789790

790791
try:
791-
process = subprocess.Popen(conf.alert.encode(sys.getfilesystemencoding() or UNICODE_ENCODING), shell=True)
792+
process = subprocess.Popen(getBytes(conf.alert, sys.getfilesystemencoding() or UNICODE_ENCODING), shell=True)
792793
process.wait()
793794
except Exception as ex:
794795
errMsg = "error occurred while executing '%s' ('%s')" % (conf.alert, getSafeExString(ex))

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ def safeFilepathEncode(filepath):
19701970
retVal = filepath
19711971

19721972
if filepath and six.PY2 and isinstance(filepath, six.text_type):
1973-
retVal = filepath.encode(sys.getfilesystemencoding() or UNICODE_ENCODING)
1973+
retVal = getBytes(filepath, sys.getfilesystemencoding() or UNICODE_ENCODING)
19741974

19751975
return retVal
19761976

lib/core/convert.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ def getBytes(value, encoding=UNICODE_ENCODING, errors="strict", unsafe=True):
231231

232232
retVal = value
233233

234+
try:
235+
codecs.lookup(encoding)
236+
except LookupError:
237+
encoding = UNICODE_ENCODING
238+
234239
if isinstance(value, six.text_type):
235240
if INVALID_UNICODE_PRIVATE_AREA:
236241
if unsafe:
@@ -391,4 +396,4 @@ def getConsoleLength(value):
391396
else:
392397
retVal = len(value)
393398

394-
return retVal
399+
return retVal

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.11.117"
21+
VERSION = "1.3.11.118"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

0 commit comments

Comments
 (0)