mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
Implementation for an Issue #195
This commit is contained in:
parent
9ca7b3e20e
commit
c9e7e71ea2
|
@ -117,6 +117,7 @@ from lib.core.threads import getCurrentThreadData
|
|||
from lib.core.update import update
|
||||
from lib.parse.configfile import configFileParser
|
||||
from lib.parse.payloads import loadPayloads
|
||||
from lib.request.basic import checkCharEncoding
|
||||
from lib.request.connect import Connect as Request
|
||||
from lib.request.dns import DNSServer
|
||||
from lib.request.proxy import ProxyHTTPSHandler
|
||||
|
@ -1965,13 +1966,14 @@ def __basicOptionValidation():
|
|||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
if conf.charset:
|
||||
try:
|
||||
codecs.lookup(conf.charset)
|
||||
except LookupError:
|
||||
_ = checkCharEncoding(conf.charset, False)
|
||||
if _ is None:
|
||||
errMsg = "unknown charset '%s'. Please visit " % conf.charset
|
||||
errMsg += "'%s' to get the full list of " % CODECS_LIST_PAGE
|
||||
errMsg += "supported charsets"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
else:
|
||||
conf.charset = _
|
||||
|
||||
if conf.loadCookies:
|
||||
if not os.path.exists(conf.loadCookies):
|
||||
|
|
|
@ -100,14 +100,14 @@ def parseResponse(page, headers):
|
|||
if page:
|
||||
htmlParser(page)
|
||||
|
||||
def checkCharEncoding(encoding):
|
||||
def checkCharEncoding(encoding, warn=True):
|
||||
if encoding:
|
||||
encoding = encoding.lower()
|
||||
else:
|
||||
return encoding
|
||||
|
||||
# http://www.destructor.de/charsets/index.htm
|
||||
translate = { "windows-874": "iso-8859-11", "en_us": "utf8", "macintosh": "iso-8859-1", "euc_tw": "big5_tw", "th": "tis-620", "unicode": "utf8", "utc8": "utf8"}
|
||||
translate = { "windows-874": "iso-8859-11", "en_us": "utf8", "macintosh": "iso-8859-1", "euc_tw": "big5_tw", "th": "tis-620", "unicode": "utf8", "utc8": "utf8", "ebcdic": "ebcdic-cp-be"}
|
||||
|
||||
for delimiter in (';', ',', '('):
|
||||
if delimiter in encoding:
|
||||
|
@ -156,9 +156,10 @@ def checkCharEncoding(encoding):
|
|||
try:
|
||||
codecs.lookup(encoding)
|
||||
except LookupError:
|
||||
warnMsg = "unknown web page charset '%s'. " % encoding
|
||||
warnMsg += "Please report by e-mail to %s." % ML
|
||||
singleTimeLogMessage(warnMsg, logging.WARN, encoding)
|
||||
if warn:
|
||||
warnMsg = "unknown web page charset '%s'. " % encoding
|
||||
warnMsg += "Please report by e-mail to %s." % ML
|
||||
singleTimeLogMessage(warnMsg, logging.WARN, encoding)
|
||||
encoding = None
|
||||
|
||||
return encoding
|
||||
|
|
Loading…
Reference in New Issue
Block a user