mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-04-25 19:33:48 +03:00
Major bug fix, be careful when editing isWindowsPath() and normalizePath() in common.py, they can break all
This commit is contained in:
parent
66c9885b96
commit
8c68d25b39
|
@ -871,11 +871,18 @@ def directoryPath(path):
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def normalizePath(path):
|
def normalizePath(path):
|
||||||
|
"""
|
||||||
|
This function must be called only after posixToNtSlashes()
|
||||||
|
and ntToPosixSlashes()
|
||||||
|
"""
|
||||||
|
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
if isWindowsPath(path):
|
if isWindowsPath(path):
|
||||||
retVal = ntpath.normpath(path)
|
retVal = ntpath.normpath(path)
|
||||||
else:
|
else:
|
||||||
retVal = posixpath.normpath(path)
|
retVal = posixpath.normpath(path)
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def safeStringFormat(formatStr, params):
|
def safeStringFormat(formatStr, params):
|
||||||
|
@ -927,7 +934,7 @@ def decloakToMkstemp(filepath, **kwargs):
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def isWindowsPath(filepath):
|
def isWindowsPath(filepath):
|
||||||
return re.search("\A[A-Za-z]:", filepath) is not None
|
return re.search("\A[\w]\:\\\\", filepath) is not None
|
||||||
|
|
||||||
def posixToNtSlashes(filepath):
|
def posixToNtSlashes(filepath):
|
||||||
return filepath.replace('/', '\\')
|
return filepath.replace('/', '\\')
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Miscellaneous:
|
||||||
else:
|
else:
|
||||||
conf.tmpPath = "/tmp"
|
conf.tmpPath = "/tmp"
|
||||||
|
|
||||||
if re.search("^[\w]\:[\/\\\\]+", conf.tmpPath, re.I):
|
if re.search("\A[\w]:[\/\\\\]+", conf.tmpPath, re.I):
|
||||||
kb.os = "Windows"
|
kb.os = "Windows"
|
||||||
|
|
||||||
conf.tmpPath = ntToPosixSlashes(conf.tmpPath)
|
conf.tmpPath = ntToPosixSlashes(conf.tmpPath)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user