mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-20 07:00:25 +00:00
Fix for --dump-format=HTML with --start/--stop appending a whole new document
This commit is contained in:
parent
2bfb53876c
commit
910fccb65e
2 changed files with 14 additions and 3 deletions
|
|
@ -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 "</tbody>" in content:
|
||||
with openFile(dumpFileName, "w+") as f:
|
||||
f.write(content[:content.rindex("</tbody>")])
|
||||
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, "<!DOCTYPE html>\n<html>\n<head>\n")
|
||||
dataToDumpFile(dumpFP, "<meta http-equiv=\"Content-type\" content=\"text/html;charset=%s\">\n" % UNICODE_ENCODING)
|
||||
dataToDumpFile(dumpFP, "<meta name=\"generator\" content=\"%s\" />\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</tr>\n</thead>\n<tbody>\n")
|
||||
|
||||
self._write("|\n%s" % separator)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.11.71"
|
||||
VERSION = "1.10.11.72"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue