This commit is contained in:
Miroslav Stampar 2016-04-04 12:25:07 +02:00
parent e83d8f6143
commit 31d7021d4c
3 changed files with 12 additions and 6 deletions

View File

@ -1023,14 +1023,17 @@ def getHeader(headers, key):
break
return retVal
def checkFile(filename):
def checkFile(filename, raiseOnError=True):
"""
Checks for file existence and readability
"""
valid = True
if filename is None or not os.path.isfile(filename):
try:
if filename is None or not os.path.isfile(filename):
valid = False
except UnicodeError:
valid = False
if valid:
@ -1040,9 +1043,11 @@ def checkFile(filename):
except:
valid = False
if not valid:
if not valid and raiseOnError:
raise SqlmapSystemException("unable to read file '%s'" % filename)
return valid
def banner():
"""
This function prints sqlmap banner with its version

View File

@ -13,6 +13,7 @@ import tempfile
import threading
from lib.core.common import Backend
from lib.core.common import checkFile
from lib.core.common import dataToDumpFile
from lib.core.common import dataToStdout
from lib.core.common import getSafeExString
@ -434,7 +435,7 @@ class Dump(object):
dumpDbPath = tempDir
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))
if not os.path.isfile(dumpFileName):
if not checkFile(dumpFileName, False):
try:
openFile(dumpFileName, "w+b").close()
except SqlmapSystemException:
@ -449,7 +450,7 @@ class Dump(object):
else:
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)
count = int(tableValues["__infos__"]["count"])

View File

@ -20,7 +20,7 @@ from lib.core.enums import OS
from lib.core.revision import getRevisionNumber
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.0.3.10"
VERSION = "1.0.3.11"
REVISION = getRevisionNumber()
STABLE = VERSION.count('.') <= 2
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")