Skip to content

Commit 9785187

Browse files
committed
Minor optimization
1 parent ea0783d commit 9785187

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

data/txt/sha256sums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ c1cb56f2a43e9f2f6b25d5f3d504e856ea21df6fc14af5e37b1000feef2bdb5a lib/core/optio
188188
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
189189
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
190190
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
191-
c811fffa88aa0deb40e6da2854b8705eec75ef6375a760535c71c21a8cde98f7 lib/core/settings.py
191+
32da56610381544b8cb37cd496cb9492b69a54cc9b7926eae4984be18017c598 lib/core/settings.py
192192
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
193193
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
194194
d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py
@@ -211,7 +211,7 @@ d2e771cdacef25ee3fdc0e0355b92e7cd1b68f5edc2756ffc19f75d183ba2c73 lib/parse/payl
211211
a1c638493ecdc5194db7186bbfed815c6eed2344f2607cac8c9fa50534824266 lib/request/basic.py
212212
bc61bc944b81a7670884f82231033a6ac703324b34b071c9834886a92e249d0e lib/request/chunkedhandler.py
213213
2daf0ce19eacda64687f441c90ef8da51714c3e8947c993ba08fb4ecdc4f5287 lib/request/comparison.py
214-
f83140c85be7f572f83c4ab4279fa1d8601243210cdfe4a44b2fc218befbcffd lib/request/connect.py
214+
c7ab9699f30b67fdee3ddafdc215981da21aa6820d8dcd620f5c2ca82ddde2f4 lib/request/connect.py
215215
8e06682280fce062eef6174351bfebcb6040e19976acff9dc7b3699779783498 lib/request/direct.py
216216
cf019248253a5d7edb7bc474aa020b9e8625d73008a463c56ba2b539d7f2d8ec lib/request/dns.py
217217
f56fc33251bd6214e3a6316c8f843eb192b2996aa84bd4c3e98790fdcf6e8cf0 lib/request/httpshandler.py

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.2.6"
23+
VERSION = "1.10.2.7"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,17 +227,18 @@ def _retryProxy(**kwargs):
227227

228228
@staticmethod
229229
def _connReadProxy(conn):
230-
retVal = b""
230+
parts = []
231231

232232
if not kb.dnsMode and conn:
233233
headers = conn.info()
234234
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()):
235-
retVal = conn.read(MAX_CONNECTION_TOTAL_SIZE)
236-
if len(retVal) == MAX_CONNECTION_TOTAL_SIZE:
235+
part = conn.read(MAX_CONNECTION_TOTAL_SIZE)
236+
if len(part) == MAX_CONNECTION_TOTAL_SIZE:
237237
warnMsg = "large compressed response detected. Disabling compression"
238238
singleTimeWarnMessage(warnMsg)
239239
kb.pageCompress = False
240240
raise SqlmapCompressionException
241+
parts.append(part)
241242
else:
242243
while True:
243244
if not conn:
@@ -252,18 +253,20 @@ def _connReadProxy(conn):
252253
warnMsg = "large response detected. This could take a while"
253254
singleTimeWarnMessage(warnMsg)
254255
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)
255-
retVal += part
256+
parts.append(part)
256257
else:
257-
retVal += part
258+
parts.append(part)
258259
break
259260

260-
if len(retVal) > MAX_CONNECTION_TOTAL_SIZE:
261+
if sum(len(_) for _ in parts) > MAX_CONNECTION_TOTAL_SIZE:
261262
warnMsg = "too large response detected. Automatically trimming it"
262263
singleTimeWarnMessage(warnMsg)
263264
break
264265

265266
if conf.yuge:
266-
retVal = YUGE_FACTOR * retVal
267+
parts = YUGE_FACTOR * parts
268+
269+
retVal = b"".join(parts)
267270

268271
return retVal
269272

0 commit comments

Comments
 (0)