mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 19:55:47 +03:00
Adding support for appending to the existing table dump if --start/--stop is used
This commit is contained in:
parent
e3a02f56e6
commit
63d7707346
|
@ -366,6 +366,7 @@ class Dump(object):
|
|||
replication = None
|
||||
rtable = None
|
||||
dumpFP = None
|
||||
appendToFile = False
|
||||
|
||||
if tableValues is None:
|
||||
return
|
||||
|
@ -388,7 +389,8 @@ class Dump(object):
|
|||
os.makedirs(dumpDbPath, 0755)
|
||||
|
||||
dumpFileName = "%s%s%s.%s" % (dumpDbPath, os.sep, unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower())
|
||||
dumpFP = openFile(dumpFileName, "wb")
|
||||
appendToFile = os.path.isfile(dumpFileName) and any((conf.limitStart, conf.limitStop))
|
||||
dumpFP = openFile(dumpFileName, "wb" if not appendToFile else "ab")
|
||||
|
||||
count = int(tableValues["__infos__"]["count"])
|
||||
separator = str()
|
||||
|
@ -466,6 +468,7 @@ class Dump(object):
|
|||
|
||||
self._write("| %s%s" % (column, blank), newline=False)
|
||||
|
||||
if not appendToFile:
|
||||
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
||||
if field == fields:
|
||||
dataToDumpFile(dumpFP, "%s" % safeCSValue(column))
|
||||
|
@ -481,7 +484,7 @@ class Dump(object):
|
|||
self._write("|\n%s" % separator)
|
||||
|
||||
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
||||
dataToDumpFile(dumpFP, "\n")
|
||||
dataToDumpFile(dumpFP, "\n" if not appendToFile else "")
|
||||
|
||||
elif conf.dumpFormat == DUMP_FORMAT.SQLITE:
|
||||
rtable.beginTransaction()
|
||||
|
|
Loading…
Reference in New Issue
Block a user