diff --git a/lib/core/dump.py b/lib/core/dump.py index d761f7008..b33a6b279 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -530,6 +530,17 @@ class Dump(object): else: count += 1 + # Note: appending to HTML means adding rows to the existing table (i.e. not appending a whole new document) + if appendToFile and conf.dumpFormat == DUMP_FORMAT.HTML: + with openFile(dumpFileName, "r") as f: + content = f.read() + + if "" in content: + with openFile(dumpFileName, "w+") as f: + f.write(content[:content.rindex("")]) + else: + appendToFile = False + self._dumpFiles[dumpFileName] = table dumpFP = openFile(dumpFileName, 'w' if not appendToFile else 'a', buffering=DUMP_FILE_BUFFER_SIZE) @@ -603,7 +614,7 @@ class Dump(object): cols.append((unsafeSQLIdentificatorNaming(column), colType if colType else Replication.TEXT)) rtable = replication.createTable(table, cols) - elif conf.dumpFormat == DUMP_FORMAT.HTML: + elif conf.dumpFormat == DUMP_FORMAT.HTML and not appendToFile: dataToDumpFile(dumpFP, "\n\n
\n") dataToDumpFile(dumpFP, "\n" % UNICODE_ENCODING) dataToDumpFile(dumpFP, "\n" % VERSION_STRING) @@ -639,7 +650,7 @@ class Dump(object): field += 1 - if conf.dumpFormat == DUMP_FORMAT.HTML: + if conf.dumpFormat == DUMP_FORMAT.HTML and not appendToFile: dataToDumpFile(dumpFP, "\n\n\n\n") self._write("|\n%s" % separator) diff --git a/lib/core/settings.py b/lib/core/settings.py index bc6276c15..610410e75 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (