mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-22 03:33:57 +00:00
Minor optimization
This commit is contained in:
parent
ea0783d381
commit
97851871f5
3 changed files with 13 additions and 10 deletions
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.2.6"
|
||||
VERSION = "1.10.2.7"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -227,17 +227,18 @@ class Connect(object):
|
|||
|
||||
@staticmethod
|
||||
def _connReadProxy(conn):
|
||||
retVal = b""
|
||||
parts = []
|
||||
|
||||
if not kb.dnsMode and conn:
|
||||
headers = conn.info()
|
||||
if kb.pageCompress and headers and hasattr(headers, "getheader") and (headers.getheader(HTTP_HEADER.CONTENT_ENCODING, "").lower() in ("gzip", "deflate") or "text" not in headers.getheader(HTTP_HEADER.CONTENT_TYPE, "").lower()):
|
||||
retVal = conn.read(MAX_CONNECTION_TOTAL_SIZE)
|
||||
if len(retVal) == MAX_CONNECTION_TOTAL_SIZE:
|
||||
part = conn.read(MAX_CONNECTION_TOTAL_SIZE)
|
||||
if len(part) == MAX_CONNECTION_TOTAL_SIZE:
|
||||
warnMsg = "large compressed response detected. Disabling compression"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
kb.pageCompress = False
|
||||
raise SqlmapCompressionException
|
||||
parts.append(part)
|
||||
else:
|
||||
while True:
|
||||
if not conn:
|
||||
|
|
@ -252,18 +253,20 @@ class Connect(object):
|
|||
warnMsg = "large response detected. This could take a while"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
part = re.sub(getBytes(r"(?si)%s.+?%s" % (kb.chars.stop, kb.chars.start)), getBytes("%s%s%s" % (kb.chars.stop, LARGE_READ_TRIM_MARKER, kb.chars.start)), part)
|
||||
retVal += part
|
||||
parts.append(part)
|
||||
else:
|
||||
retVal += part
|
||||
parts.append(part)
|
||||
break
|
||||
|
||||
if len(retVal) > MAX_CONNECTION_TOTAL_SIZE:
|
||||
if sum(len(_) for _ in parts) > MAX_CONNECTION_TOTAL_SIZE:
|
||||
warnMsg = "too large response detected. Automatically trimming it"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
break
|
||||
|
||||
if conf.yuge:
|
||||
retVal = YUGE_FACTOR * retVal
|
||||
parts = YUGE_FACTOR * parts
|
||||
|
||||
retVal = b"".join(parts)
|
||||
|
||||
return retVal
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue