mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-23 01:56:36 +03:00
Minor refactoring
This commit is contained in:
parent
9404b63a42
commit
d148694a4b
|
@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||||
from lib.core.enums import OS
|
from lib.core.enums import OS
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.1.11.8"
|
VERSION = "1.1.11.9"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -254,12 +254,22 @@ def decodePage(page, contentEncoding, contentType):
|
||||||
if not page or (conf.nullConnection and len(page) < 2):
|
if not page or (conf.nullConnection and len(page) < 2):
|
||||||
return getUnicode(page)
|
return getUnicode(page)
|
||||||
|
|
||||||
if isinstance(contentEncoding, basestring) and contentEncoding.lower() in ("gzip", "x-gzip", "deflate"):
|
if isinstance(contentEncoding, basestring) and contentEncoding:
|
||||||
|
contentEncoding = contentEncoding.lower()
|
||||||
|
else:
|
||||||
|
contentEncoding = ""
|
||||||
|
|
||||||
|
if isinstance(contentType, basestring) and contentType:
|
||||||
|
contentType = contentType.lower()
|
||||||
|
else:
|
||||||
|
contentType = ""
|
||||||
|
|
||||||
|
if contentEncoding in ("gzip", "x-gzip", "deflate"):
|
||||||
if not kb.pageCompress:
|
if not kb.pageCompress:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if contentEncoding.lower() == "deflate":
|
if contentEncoding == "deflate":
|
||||||
data = StringIO.StringIO(zlib.decompress(page, -15)) # Reference: http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
|
data = StringIO.StringIO(zlib.decompress(page, -15)) # Reference: http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
|
||||||
else:
|
else:
|
||||||
data = gzip.GzipFile("", "rb", 9, StringIO.StringIO(page))
|
data = gzip.GzipFile("", "rb", 9, StringIO.StringIO(page))
|
||||||
|
@ -284,7 +294,7 @@ def decodePage(page, contentEncoding, contentType):
|
||||||
httpCharset, metaCharset = None, None
|
httpCharset, metaCharset = None, None
|
||||||
|
|
||||||
# Reference: http://stackoverflow.com/questions/1020892/python-urllib2-read-to-unicode
|
# Reference: http://stackoverflow.com/questions/1020892/python-urllib2-read-to-unicode
|
||||||
if contentType and (contentType.find("charset=") != -1):
|
if contentType.find("charset=") != -1:
|
||||||
httpCharset = checkCharEncoding(contentType.split("charset=")[-1])
|
httpCharset = checkCharEncoding(contentType.split("charset=")[-1])
|
||||||
|
|
||||||
metaCharset = checkCharEncoding(extractRegexResult(META_CHARSET_REGEX, page))
|
metaCharset = checkCharEncoding(extractRegexResult(META_CHARSET_REGEX, page))
|
||||||
|
@ -300,7 +310,7 @@ def decodePage(page, contentEncoding, contentType):
|
||||||
kb.pageEncoding = conf.encoding
|
kb.pageEncoding = conf.encoding
|
||||||
|
|
||||||
# can't do for all responses because we need to support binary files too
|
# can't do for all responses because we need to support binary files too
|
||||||
if contentType and not isinstance(page, unicode) and "text/" in contentType.lower():
|
if not isinstance(page, unicode) and "text/" in contentType:
|
||||||
if kb.heuristicMode:
|
if kb.heuristicMode:
|
||||||
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
|
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
|
||||||
page = getUnicode(page, kb.pageEncoding)
|
page = getUnicode(page, kb.pageEncoding)
|
||||||
|
|
|
@ -46,7 +46,7 @@ ec6a778b0e74749b916caead78ba88b7 lib/core/option.py
|
||||||
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
|
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
|
||||||
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
|
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
|
||||||
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
|
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
|
||||||
15a317ddbd48bdf94e1642df57664790 lib/core/settings.py
|
4092cefeab1270e5f9a987582eb1c099 lib/core/settings.py
|
||||||
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
|
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
|
||||||
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
|
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
|
||||||
7c9f2af3c0a8dd89223cfe07b0a0b826 lib/core/target.py
|
7c9f2af3c0a8dd89223cfe07b0a0b826 lib/core/target.py
|
||||||
|
|
Loading…
Reference in New Issue
Block a user