mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Patch for an Issue #1124
This commit is contained in:
parent
cd743ab098
commit
02b3eb941f
|
@ -14,6 +14,7 @@ import hashlib
|
|||
import httplib
|
||||
import inspect
|
||||
import json
|
||||
import locale
|
||||
import logging
|
||||
import ntpath
|
||||
import os
|
||||
|
@ -1558,6 +1559,22 @@ def normalizePath(filepath):
|
|||
|
||||
return retVal
|
||||
|
||||
def safeExpandUser(filepath):
|
||||
"""
|
||||
Patch for a Python Issue18171 (http://bugs.python.org/issue18171)
|
||||
"""
|
||||
|
||||
retVal = filepath
|
||||
|
||||
try:
|
||||
retVal = os.path.expanduser(filepath)
|
||||
except UnicodeDecodeError:
|
||||
_ = locale.getdefaultlocale()
|
||||
retVal = getUnicode(os.path.expanduser(filepath.encode(_[1] if _ and len(_) > 1 else UNICODE_ENCODING)))
|
||||
|
||||
print retVal
|
||||
return retVal
|
||||
|
||||
def safeStringFormat(format_, params):
|
||||
"""
|
||||
Avoids problems with inappropriate string format strings
|
||||
|
|
|
@ -52,6 +52,7 @@ from lib.core.common import readCachedFileContent
|
|||
from lib.core.common import readInput
|
||||
from lib.core.common import resetCookieJar
|
||||
from lib.core.common import runningAsAdmin
|
||||
from lib.core.common import safeExpandUser
|
||||
from lib.core.common import sanitizeStr
|
||||
from lib.core.common import setOptimize
|
||||
from lib.core.common import setPaths
|
||||
|
@ -496,7 +497,7 @@ def _setRequestFromFile():
|
|||
|
||||
addedTargetUrls = set()
|
||||
|
||||
conf.requestFile = os.path.expanduser(conf.requestFile)
|
||||
conf.requestFile = safeExpandUser(conf.requestFile)
|
||||
|
||||
infoMsg = "parsing HTTP request from '%s'" % conf.requestFile
|
||||
logger.info(infoMsg)
|
||||
|
@ -619,7 +620,7 @@ def _setBulkMultipleTargets():
|
|||
if not conf.bulkFile:
|
||||
return
|
||||
|
||||
conf.bulkFile = os.path.expanduser(conf.bulkFile)
|
||||
conf.bulkFile = safeExpandUser(conf.bulkFile)
|
||||
|
||||
infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile
|
||||
logger.info(infoMsg)
|
||||
|
@ -1268,7 +1269,7 @@ def _setHTTPAuthentication():
|
|||
debugMsg = "setting the HTTP(s) authentication PEM private key"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
_ = os.path.expanduser(conf.authPrivate)
|
||||
_ = safeExpandUser(conf.authPrivate)
|
||||
checkFile(_)
|
||||
authHandler = HTTPSPKIAuthHandler(_)
|
||||
|
||||
|
@ -1475,7 +1476,7 @@ def _cleanupOptions():
|
|||
|
||||
for key, value in conf.items():
|
||||
if value and any(key.endswith(_) for _ in ("Path", "File")):
|
||||
conf[key] = os.path.expanduser(value)
|
||||
conf[key] = safeExpandUser(value)
|
||||
|
||||
if conf.testParameter:
|
||||
conf.testParameter = urldecode(conf.testParameter)
|
||||
|
|
Loading…
Reference in New Issue
Block a user