From cb1b5d30fddfd5d4b27b09ae93c8e11ab3269859 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 12 Dec 2017 10:48:19 +0100 Subject: [PATCH] Minor refactoring --- lib/core/bigarray.py | 12 +++++------- lib/core/settings.py | 2 +- txt/checksum.md5 | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/core/bigarray.py b/lib/core/bigarray.py index e3c0b704b..b65d81d2b 100644 --- a/lib/core/bigarray.py +++ b/lib/core/bigarray.py @@ -52,7 +52,7 @@ class BigArray(list): List-like class used for storing large amounts of data (disk cached) """ - def __init__(self): + def __init__(self, items=[]): self.chunks = [[]] self.chunk_length = sys.maxint self.cache = None @@ -60,6 +60,9 @@ class BigArray(list): self._os_remove = os.remove self._size_counter = 0 + for item in items: + self.append(item) + def append(self, value): self.chunks[-1].append(value) @@ -136,15 +139,10 @@ class BigArray(list): self.chunks, self.filenames = state def __getslice__(self, i, j): - retval = BigArray() - i = max(0, len(self) + i if i < 0 else i) j = min(len(self), len(self) + j if j < 0 else j) - for _ in xrange(i, j): - retval.append(self[_]) - - return retval + return BigArray(self[_] for _ in xrange(i, j)) def __getitem__(self, y): if y < 0: diff --git a/lib/core/settings.py b/lib/core/settings.py index 152fafb8b..313907e97 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.12.12" +VERSION = "1.1.12.13" 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) diff --git a/txt/checksum.md5 b/txt/checksum.md5 index e1024063f..18225a69b 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -26,7 +26,7 @@ c0c9a87e5829c76efc69067081edb8b1 lib/controller/checks.py d2cdb9e832e18a81e936ca3348144b16 lib/controller/handler.py 5fb9aaf874daa47ea2b672a22740e56b lib/controller/__init__.py f8a7165253874a9ce0c6e0d089e5fb8c lib/core/agent.py -8d9d771f7e67582c56a96a8d0ccbe4fc lib/core/bigarray.py +9eccf8db8b8e259e30c1eade4ee499b0 lib/core/bigarray.py d359917cd034d4d353cfd699bd201693 lib/core/common.py 54326d3a690f8b26fe5a5da1a589b369 lib/core/convert.py 90b1b08368ac8a859300e6fa6a8c796e lib/core/data.py @@ -46,7 +46,7 @@ f872699e948d0692ce11b54781da814c lib/core/log.py 760d9df2a27ded29109b390ab202e72d lib/core/replication.py a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py 02d4762140a72fd44668d3dab5eabda9 lib/core/session.py -8b4e97576189f033d919e9642e423d73 lib/core/settings.py +e4e0634721ad8f7ad97e32519451e5f9 lib/core/settings.py 35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py d93501771b41315f9fb949305b6ed257 lib/core/target.py