Skip to content

Commit

Permalink
Performing a backup of old dump file (Issue #841)
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Jun 5, 2016
1 parent 8238295 commit 7fb9db4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/core/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import hashlib
import os
import re
import shutil
import tempfile
import threading

Expand Down Expand Up @@ -452,6 +453,16 @@ def dbTableValues(self, tableValues):
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"])
Expand Down
2 changes: 1 addition & 1 deletion lib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from lib.core.revision import getRevisionNumber

# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
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")
Expand Down

0 comments on commit 7fb9db4

Please sign in to comment.