From 7fb9db42a79e8edb7916e4a361a6ac1c076839c1 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 5 Jun 2016 12:37:19 +0200 Subject: [PATCH] Performing a backup of old dump file (Issue #841) --- lib/core/dump.py | 11 +++++++++++ lib/core/settings.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index 3cc15cc66..f096482ef 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -9,6 +9,7 @@ import cgi import hashlib import os import re +import shutil import tempfile import threading @@ -452,6 +453,16 @@ class Dump(object): else: 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) count = int(tableValues["__infos__"]["count"]) diff --git a/lib/core/settings.py b/lib/core/settings.py index 38a7dfb3a..76fee2093 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.6.26" +VERSION = "1.0.6.27" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")