mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
Fixes #1794
This commit is contained in:
parent
e83d8f6143
commit
31d7021d4c
|
@ -1023,15 +1023,18 @@ def getHeader(headers, key):
|
||||||
break
|
break
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def checkFile(filename):
|
def checkFile(filename, raiseOnError=True):
|
||||||
"""
|
"""
|
||||||
Checks for file existence and readability
|
Checks for file existence and readability
|
||||||
"""
|
"""
|
||||||
|
|
||||||
valid = True
|
valid = True
|
||||||
|
|
||||||
|
try:
|
||||||
if filename is None or not os.path.isfile(filename):
|
if filename is None or not os.path.isfile(filename):
|
||||||
valid = False
|
valid = False
|
||||||
|
except UnicodeError:
|
||||||
|
valid = False
|
||||||
|
|
||||||
if valid:
|
if valid:
|
||||||
try:
|
try:
|
||||||
|
@ -1040,9 +1043,11 @@ def checkFile(filename):
|
||||||
except:
|
except:
|
||||||
valid = False
|
valid = False
|
||||||
|
|
||||||
if not valid:
|
if not valid and raiseOnError:
|
||||||
raise SqlmapSystemException("unable to read file '%s'" % filename)
|
raise SqlmapSystemException("unable to read file '%s'" % filename)
|
||||||
|
|
||||||
|
return valid
|
||||||
|
|
||||||
def banner():
|
def banner():
|
||||||
"""
|
"""
|
||||||
This function prints sqlmap banner with its version
|
This function prints sqlmap banner with its version
|
||||||
|
|
|
@ -13,6 +13,7 @@ import tempfile
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from lib.core.common import Backend
|
from lib.core.common import Backend
|
||||||
|
from lib.core.common import checkFile
|
||||||
from lib.core.common import dataToDumpFile
|
from lib.core.common import dataToDumpFile
|
||||||
from lib.core.common import dataToStdout
|
from lib.core.common import dataToStdout
|
||||||
from lib.core.common import getSafeExString
|
from lib.core.common import getSafeExString
|
||||||
|
@ -434,7 +435,7 @@ class Dump(object):
|
||||||
dumpDbPath = tempDir
|
dumpDbPath = tempDir
|
||||||
|
|
||||||
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))
|
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))
|
||||||
if not os.path.isfile(dumpFileName):
|
if not checkFile(dumpFileName, False):
|
||||||
try:
|
try:
|
||||||
openFile(dumpFileName, "w+b").close()
|
openFile(dumpFileName, "w+b").close()
|
||||||
except SqlmapSystemException:
|
except SqlmapSystemException:
|
||||||
|
@ -449,7 +450,7 @@ class Dump(object):
|
||||||
else:
|
else:
|
||||||
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (_, conf.dumpFormat.lower()))
|
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (_, conf.dumpFormat.lower()))
|
||||||
|
|
||||||
appendToFile = os.path.isfile(dumpFileName) and any((conf.limitStart, conf.limitStop))
|
appendToFile = any((conf.limitStart, conf.limitStop)) and checkFile(dumpFileName, False)
|
||||||
dumpFP = openFile(dumpFileName, "wb" if not appendToFile else "ab", buffering=DUMP_FILE_BUFFER_SIZE)
|
dumpFP = openFile(dumpFileName, "wb" if not appendToFile else "ab", buffering=DUMP_FILE_BUFFER_SIZE)
|
||||||
|
|
||||||
count = int(tableValues["__infos__"]["count"])
|
count = int(tableValues["__infos__"]["count"])
|
||||||
|
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
||||||
from lib.core.revision import getRevisionNumber
|
from lib.core.revision import getRevisionNumber
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.0.3.10"
|
VERSION = "1.0.3.11"
|
||||||
REVISION = getRevisionNumber()
|
REVISION = getRevisionNumber()
|
||||||
STABLE = VERSION.count('.') <= 2
|
STABLE = VERSION.count('.') <= 2
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
|
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user