mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
Fix for an Issue #546
This commit is contained in:
parent
2ee4b81a6e
commit
e197720def
|
@ -5,12 +5,11 @@ Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
|
||||||
See the file 'doc/COPYING' for copying permission
|
See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import cgi
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from xml.dom.minidom import getDOMImplementation
|
|
||||||
|
|
||||||
from lib.core.common import Backend
|
from lib.core.common import Backend
|
||||||
from lib.core.common import dataToDumpFile
|
from lib.core.common import dataToDumpFile
|
||||||
from lib.core.common import dataToStdout
|
from lib.core.common import dataToStdout
|
||||||
|
@ -442,8 +441,11 @@ class Dump(object):
|
||||||
|
|
||||||
rtable = replication.createTable(table, cols)
|
rtable = replication.createTable(table, cols)
|
||||||
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
documentNode = getDOMImplementation().createDocument(None, "table", None)
|
dataToDumpFile(dumpFP, "<!DOCTYPE html>\n<html>\n<head>\n")
|
||||||
tableNode = documentNode.documentElement
|
dataToDumpFile(dumpFP, "<meta http-equiv=\"Content-type\" content=\"text/html;charset=%s\">\n" % UNICODE_ENCODING)
|
||||||
|
dataToDumpFile(dumpFP, "<title>%s</title>\n" % ("%s%s" % ("%s." % db if METADB_SUFFIX not in db else "", table)))
|
||||||
|
dataToDumpFile(dumpFP, HTML_DUMP_CSS_STYLE)
|
||||||
|
dataToDumpFile(dumpFP, "\n</head>\n<body>\n<table>\n<thead>\n<tr>\n")
|
||||||
|
|
||||||
if count == 1:
|
if count == 1:
|
||||||
self._write("[1 entry]")
|
self._write("[1 entry]")
|
||||||
|
@ -452,14 +454,6 @@ class Dump(object):
|
||||||
|
|
||||||
self._write(separator)
|
self._write(separator)
|
||||||
|
|
||||||
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
|
||||||
headNode = documentNode.createElement("thead")
|
|
||||||
rowNode = documentNode.createElement("tr")
|
|
||||||
tableNode.appendChild(headNode)
|
|
||||||
headNode.appendChild(rowNode)
|
|
||||||
bodyNode = documentNode.createElement("tbody")
|
|
||||||
tableNode.appendChild(bodyNode)
|
|
||||||
|
|
||||||
for column in columns:
|
for column in columns:
|
||||||
if column != "__infos__":
|
if column != "__infos__":
|
||||||
info = tableValues[column]
|
info = tableValues[column]
|
||||||
|
@ -477,12 +471,13 @@ class Dump(object):
|
||||||
else:
|
else:
|
||||||
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(column), conf.csvDel))
|
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(column), conf.csvDel))
|
||||||
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
entryNode = documentNode.createElement("td")
|
dataToDumpFile(dumpFP, "<th>%s</th>" % cgi.escape(column).encode("ascii", "xmlcharrefreplace"))
|
||||||
rowNode.appendChild(entryNode)
|
|
||||||
entryNode.appendChild(documentNode.createTextNode(column))
|
|
||||||
|
|
||||||
field += 1
|
field += 1
|
||||||
|
|
||||||
|
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
|
dataToDumpFile(dumpFP, "\n</tr>\n</thead>\n<tbody>\n")
|
||||||
|
|
||||||
self._write("|\n%s" % separator)
|
self._write("|\n%s" % separator)
|
||||||
|
|
||||||
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
||||||
|
@ -503,8 +498,7 @@ class Dump(object):
|
||||||
values = []
|
values = []
|
||||||
|
|
||||||
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
rowNode = documentNode.createElement("tr")
|
dataToDumpFile(dumpFP, "<tr>")
|
||||||
bodyNode.appendChild(rowNode)
|
|
||||||
|
|
||||||
for column in columns:
|
for column in columns:
|
||||||
if column != "__infos__":
|
if column != "__infos__":
|
||||||
|
@ -547,9 +541,7 @@ class Dump(object):
|
||||||
else:
|
else:
|
||||||
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(value), conf.csvDel))
|
dataToDumpFile(dumpFP, "%s%s" % (safeCSValue(value), conf.csvDel))
|
||||||
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
entryNode = documentNode.createElement("td")
|
dataToDumpFile(dumpFP, "<td>%s</td>" % cgi.escape(value).encode("ascii", "xmlcharrefreplace"))
|
||||||
rowNode.appendChild(entryNode)
|
|
||||||
entryNode.appendChild(documentNode.createTextNode(value))
|
|
||||||
|
|
||||||
field += 1
|
field += 1
|
||||||
|
|
||||||
|
@ -560,6 +552,8 @@ class Dump(object):
|
||||||
pass
|
pass
|
||||||
elif conf.dumpFormat == DUMP_FORMAT.CSV:
|
elif conf.dumpFormat == DUMP_FORMAT.CSV:
|
||||||
dataToDumpFile(dumpFP, "\n")
|
dataToDumpFile(dumpFP, "\n")
|
||||||
|
elif conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
|
dataToDumpFile(dumpFP, "</tr>\n")
|
||||||
|
|
||||||
self._write("|", console=console)
|
self._write("|", console=console)
|
||||||
|
|
||||||
|
@ -571,13 +565,7 @@ class Dump(object):
|
||||||
|
|
||||||
elif conf.dumpFormat in (DUMP_FORMAT.CSV, DUMP_FORMAT.HTML):
|
elif conf.dumpFormat in (DUMP_FORMAT.CSV, DUMP_FORMAT.HTML):
|
||||||
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
if conf.dumpFormat == DUMP_FORMAT.HTML:
|
||||||
dataToDumpFile(dumpFP, "<!DOCTYPE html>\n<html>\n<head>\n")
|
dataToDumpFile(dumpFP, "</tbody>\n</table>\n</body>\n</html>")
|
||||||
dataToDumpFile(dumpFP, "<meta http-equiv=\"Content-type\" content=\"text/html;charset=%s\">\n" % UNICODE_ENCODING)
|
|
||||||
dataToDumpFile(dumpFP, "<title>%s</title>\n" % ("%s%s" % ("%s." % db if METADB_SUFFIX not in db else "", table)))
|
|
||||||
dataToDumpFile(dumpFP, HTML_DUMP_CSS_STYLE)
|
|
||||||
dataToDumpFile(dumpFP, "\n</head>\n")
|
|
||||||
dataToDumpFile(dumpFP, tableNode.toxml())
|
|
||||||
dataToDumpFile(dumpFP, "\n</html>")
|
|
||||||
else:
|
else:
|
||||||
dataToDumpFile(dumpFP, "\n")
|
dataToDumpFile(dumpFP, "\n")
|
||||||
dumpFP.close()
|
dumpFP.close()
|
||||||
|
|
|
@ -591,4 +591,7 @@ tr:nth-child(even) {
|
||||||
td{
|
td{
|
||||||
font-size:10px;
|
font-size:10px;
|
||||||
}
|
}
|
||||||
|
th{
|
||||||
|
font-size:10px;
|
||||||
|
}
|
||||||
</style>"""
|
</style>"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user