Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31d7021

Browse files
committed
Fixes #1794
1 parent e83d8f6 commit 31d7021

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

lib/core/common.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,14 +1023,17 @@ def getHeader(headers, key):
10231023
break
10241024
return retVal
10251025

1026-
def checkFile(filename):
1026+
def checkFile(filename, raiseOnError=True):
10271027
"""
10281028
Checks for file existence and readability
10291029
"""
10301030

10311031
valid = True
10321032

1033-
if filename is None or not os.path.isfile(filename):
1033+
try:
1034+
if filename is None or not os.path.isfile(filename):
1035+
valid = False
1036+
except UnicodeError:
10341037
valid = False
10351038

10361039
if valid:
@@ -1040,9 +1043,11 @@ def checkFile(filename):
10401043
except:
10411044
valid = False
10421045

1043-
if not valid:
1046+
if not valid and raiseOnError:
10441047
raise SqlmapSystemException("unable to read file '%s'" % filename)
10451048

1049+
return valid
1050+
10461051
def banner():
10471052
"""
10481053
This function prints sqlmap banner with its version

lib/core/dump.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import threading
1414

1515
from lib.core.common import Backend
16+
from lib.core.common import checkFile
1617
from lib.core.common import dataToDumpFile
1718
from lib.core.common import dataToStdout
1819
from lib.core.common import getSafeExString
@@ -434,7 +435,7 @@ def dbTableValues(self, tableValues):
434435
dumpDbPath = tempDir
435436

436437
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))
437-
if not os.path.isfile(dumpFileName):
438+
if not checkFile(dumpFileName, False):
438439
try:
439440
openFile(dumpFileName, "w+b").close()
440441
except SqlmapSystemException:
@@ -449,7 +450,7 @@ def dbTableValues(self, tableValues):
449450
else:
450451
dumpFileName = os.path.join(dumpDbPath, "%s.%s" % (_, conf.dumpFormat.lower()))
451452

452-
appendToFile = os.path.isfile(dumpFileName) and any((conf.limitStart, conf.limitStop))
453+
appendToFile = any((conf.limitStart, conf.limitStop)) and checkFile(dumpFileName, False)
453454
dumpFP = openFile(dumpFileName, "wb" if not appendToFile else "ab", buffering=DUMP_FILE_BUFFER_SIZE)
454455

455456
count = int(tableValues["__infos__"]["count"])

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from lib.core.revision import getRevisionNumber
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.0.3.10"
23+
VERSION = "1.0.3.11"
2424
REVISION = getRevisionNumber()
2525
STABLE = VERSION.count('.') <= 2
2626
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")

0 commit comments

Comments
 (0)