mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-29 17:49:09 +00:00
Minor improvement of BigArray's iter
This commit is contained in:
@@ -305,11 +305,29 @@ class BigArray(list):
|
||||
return "%s%s" % ("..." if len(self.chunks) > 1 else "", self.chunks[-1].__repr__())
|
||||
|
||||
def __iter__(self):
|
||||
for i in xrange(len(self)):
|
||||
try:
|
||||
yield self[i]
|
||||
except IndexError:
|
||||
break
|
||||
with self._lock:
|
||||
chunks = list(self.chunks)
|
||||
cache_index = self.cache.index if isinstance(self.cache, Cache) else None
|
||||
cache_data = self.cache.data if isinstance(self.cache, Cache) else None
|
||||
|
||||
for idx, chunk in enumerate(chunks):
|
||||
if isinstance(chunk, list):
|
||||
for item in chunk:
|
||||
yield item
|
||||
else:
|
||||
try:
|
||||
if cache_index == idx and cache_data is not None:
|
||||
data = cache_data
|
||||
else:
|
||||
with open(chunk, "rb") as f:
|
||||
data = pickle.loads(zlib.decompress(f.read()))
|
||||
except Exception as ex:
|
||||
errMsg = "exception occurred while retrieving data "
|
||||
errMsg += "from a temporary file ('%s')" % ex
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
for item in data:
|
||||
yield item
|
||||
|
||||
def __len__(self):
|
||||
return len(self.chunks[-1]) if len(self.chunks) == 1 else (len(self.chunks) - 1) * self.chunk_length + len(self.chunks[-1])
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import OS
|
||||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.1.57"
|
||||
VERSION = "1.10.1.58"
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user