Performing a backup of old dump file (Issue #841)

This commit is contained in:
Miroslav Stampar 2016-06-05 12:37:19 +02:00
parent 82382957f9
commit 7fb9db42a7
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import cgi
import hashlib import hashlib
import os import os
import re import re
import shutil
import tempfile import tempfile
import threading import threading
@ -452,6 +453,16 @@ class Dump(object):
else: else:
appendToFile = any((conf.limitStart, conf.limitStop)) appendToFile = any((conf.limitStart, conf.limitStop))
if not appendToFile:
count = 1
while True:
candidate = "%s.%d" % (dumpFileName, count)
if not checkFile(candidate, False):
shutil.copyfile(dumpFileName, candidate)
break
else:
count += 1
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"])

View File

@ -19,7 +19,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.6.26" VERSION = "1.0.6.27"
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")