Switching from old odict (non-concise ordering compared to collections) to ordereddict

This commit is contained in:
Miroslav Stampar 2019-03-11 14:36:01 +01:00
parent f4338952ac
commit c7bb44b0a2
12 changed files with 151 additions and 1445 deletions

View File

@ -15,8 +15,6 @@ This file lists bundled packages and their associated licensing terms.
Copyright (C) 2013, Jonathan Hartley. Copyright (C) 2013, Jonathan Hartley.
* The Fcrypt library located under thirdparty/fcrypt/. * The Fcrypt library located under thirdparty/fcrypt/.
Copyright (C) 2000, 2001, 2004 Carey Evans. Copyright (C) 2000, 2001, 2004 Carey Evans.
* The Odict library located under thirdparty/odict/.
Copyright (C) 2005, Nicola Larosa, Michael Foord.
* The Oset library located under thirdparty/oset/. * The Oset library located under thirdparty/oset/.
Copyright (C) 2010, BlueDynamics Alliance, Austria. Copyright (C) 2010, BlueDynamics Alliance, Austria.
Copyright (C) 2009, Raymond Hettinger, and others. Copyright (C) 2009, Raymond Hettinger, and others.
@ -281,6 +279,8 @@ be bound by the terms and conditions of this License Agreement.
* The bottle web framework library located under thirdparty/bottle/. * The bottle web framework library located under thirdparty/bottle/.
Copyright (C) 2012, Marcel Hellkamp. Copyright (C) 2012, Marcel Hellkamp.
* The ordereddict library located under thirdparty/odict/.
Copyright (C) 2009, Raymond Hettinger.
* The Termcolor library located under thirdparty/termcolor/. * The Termcolor library located under thirdparty/termcolor/.
Copyright (C) 2008-2011, Volvox Development Team. Copyright (C) 2008-2011, Volvox Development Team.

View File

@ -177,7 +177,7 @@ from thirdparty.clientform.clientform import ParseResponse
from thirdparty.clientform.clientform import ParseError from thirdparty.clientform.clientform import ParseError
from thirdparty.colorama.initialise import init as coloramainit from thirdparty.colorama.initialise import init as coloramainit
from thirdparty.magic import magic from thirdparty.magic import magic
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
from thirdparty.termcolor.termcolor import colored from thirdparty.termcolor.termcolor import colored
class UnicodeRawConfigParser(RawConfigParser): class UnicodeRawConfigParser(RawConfigParser):

View File

@ -8,7 +8,7 @@ See the file 'LICENSE' for copying permission
import copy import copy
import types import types
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
class AttribDict(dict): class AttribDict(dict):
""" """

View File

@ -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.3.3.15" VERSION = "1.3.3.16"
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)

View File

@ -73,7 +73,7 @@ from lib.core.settings import URI_INJECTABLE_REGEX
from lib.core.settings import USER_AGENT_ALIASES from lib.core.settings import USER_AGENT_ALIASES
from lib.core.settings import XML_RECOGNITION_REGEX from lib.core.settings import XML_RECOGNITION_REGEX
from lib.utils.hashdb import HashDB from lib.utils.hashdb import HashDB
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
def _setRequestParams(): def _setRequestParams():
""" """

View File

@ -47,7 +47,7 @@ from lib.parse.headers import headersParser
from lib.parse.html import htmlParser from lib.parse.html import htmlParser
from lib.utils.htmlentities import htmlEntities from lib.utils.htmlentities import htmlEntities
from thirdparty.chardet import detect from thirdparty.chardet import detect
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
def forgeHeaders(items=None, base=None): def forgeHeaders(items=None, base=None):
""" """

View File

@ -122,7 +122,7 @@ from lib.request.basic import processResponse
from lib.request.direct import direct from lib.request.direct import direct
from lib.request.comparison import comparison from lib.request.comparison import comparison
from lib.request.methodrequest import MethodRequest from lib.request.methodrequest import MethodRequest
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
from thirdparty.socks.socks import ProxyError from thirdparty.socks.socks import ProxyError
class Connect(object): class Connect(object):

View File

@ -59,7 +59,7 @@ from lib.core.threads import runThreads
from lib.core.unescaper import unescaper from lib.core.unescaper import unescaper
from lib.request.connect import Connect as Request from lib.request.connect import Connect as Request
from lib.utils.progress import ProgressBar from lib.utils.progress import ProgressBar
from thirdparty.odict.odict import OrderedDict from thirdparty.odict import OrderedDict
def _oneShotUnionUse(expression, unpack=True, limited=False): def _oneShotUnionUse(expression, unpack=True, limited=False):
retVal = hashDBRetrieve("%s%s" % (conf.hexConvert or False, expression), checkConf=True) # as UNION data is stored raw unconverted retVal = hashDBRetrieve("%s%s" % (conf.hexConvert or False, expression), checkConf=True) # as UNION data is stored raw unconverted

View File

@ -1,26 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
#
# The BSD License
#
# Copyright 2003-2008 Nicola Larosa, Michael Foord
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
pass import sys
if sys.version_info[:2] >= (2, 7):
from collections import OrderedDict
else:
from ordereddict import OrderedDict

File diff suppressed because it is too large Load Diff

127
thirdparty/odict/ordereddict.py vendored Normal file
View File

@ -0,0 +1,127 @@
# Copyright (c) 2009 Raymond Hettinger
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.update(*args, **kwds)
def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
end = self.__end
curr = end[1]
curr[2] = end[1] = self.__map[key] = [key, curr, end]
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev
def __iter__(self):
end = self.__end
curr = end[2]
while curr is not end:
yield curr[0]
curr = curr[2]
def __reversed__(self):
end = self.__end
curr = end[1]
while curr is not end:
yield curr[0]
curr = curr[1]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value
def __reduce__(self):
items = [[k, self[k]] for k in self]
tmp = self.__map, self.__end
del self.__map, self.__end
inst_dict = vars(self).copy()
self.__map, self.__end = tmp
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)
def keys(self):
return list(self)
setdefault = DictMixin.setdefault
update = DictMixin.update
pop = DictMixin.pop
values = DictMixin.values
items = DictMixin.items
iterkeys = DictMixin.iterkeys
itervalues = DictMixin.itervalues
iteritems = DictMixin.iteritems
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
if isinstance(other, OrderedDict):
if len(self) != len(other):
return False
for p, q in zip(self.items(), other.items()):
if p != q:
return False
return True
return dict.__eq__(self, other)
def __ne__(self, other):
return not self == other

View File

@ -30,10 +30,10 @@ c1da277517c7ec4c23e953a51b51e203 lib/controller/handler.py
fb6be55d21a70765e35549af2484f762 lib/controller/__init__.py fb6be55d21a70765e35549af2484f762 lib/controller/__init__.py
ed7874be0d2d3802f3d20184f2b280d5 lib/core/agent.py ed7874be0d2d3802f3d20184f2b280d5 lib/core/agent.py
a932126e7d80e545c5d44af178d0bc0c lib/core/bigarray.py a932126e7d80e545c5d44af178d0bc0c lib/core/bigarray.py
a929b8d7bb1ad777e882fa21d1795d98 lib/core/common.py 180f4f2863d45504ec0585ea72ee9924 lib/core/common.py
de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py
abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py
00828c4455321b6987e3f882f4ef4f92 lib/core/datatype.py f89512ef3ebea85611c5dde6c891b657 lib/core/datatype.py
3d547dedebef3be749cf38e4e798e120 lib/core/decorators.py 3d547dedebef3be749cf38e4e798e120 lib/core/decorators.py
5f4680b769ae07f22157bd832c97cf8f lib/core/defaults.py 5f4680b769ae07f22157bd832c97cf8f lib/core/defaults.py
9dfc69ba47209a4ceca494dde9ee8183 lib/core/dicts.py 9dfc69ba47209a4ceca494dde9ee8183 lib/core/dicts.py
@ -50,10 +50,10 @@ d5ef43fe3cdd6c2602d7db45651f9ceb lib/core/readlineng.py
7d8a22c582ad201f65b73225e4456170 lib/core/replication.py 7d8a22c582ad201f65b73225e4456170 lib/core/replication.py
3179d34f371e0295dd4604568fb30bcd lib/core/revision.py 3179d34f371e0295dd4604568fb30bcd lib/core/revision.py
d6269c55789f78cf707e09a0f5b45443 lib/core/session.py d6269c55789f78cf707e09a0f5b45443 lib/core/session.py
70d40f6779a871d6cd824aa8827426a8 lib/core/settings.py af7e2a1ab764cbe6c47e81c09035ad81 lib/core/settings.py
4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py 4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py
10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py 10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py
0a5b0a97a36c19022665f66858fd7450 lib/core/target.py d9483455ff80d33a55db46ae2fa34a05 lib/core/target.py
7857b24b7865ccb4a05283faa596974d lib/core/testing.py 7857b24b7865ccb4a05283faa596974d lib/core/testing.py
5c369aefa7c5af85dee9212acdf94bbc lib/core/threads.py 5c369aefa7c5af85dee9212acdf94bbc lib/core/threads.py
2c263c8610667fdc593c50a35ab20f57 lib/core/unescaper.py 2c263c8610667fdc593c50a35ab20f57 lib/core/unescaper.py
@ -70,9 +70,9 @@ fb6be55d21a70765e35549af2484f762 lib/parse/__init__.py
adcecd2d6a8667b22872a563eb83eac0 lib/parse/payloads.py adcecd2d6a8667b22872a563eb83eac0 lib/parse/payloads.py
993104046c7d97120613409ef7780c76 lib/parse/sitemap.py 993104046c7d97120613409ef7780c76 lib/parse/sitemap.py
e4ea70bcd461f5176867dcd89d372386 lib/request/basicauthhandler.py e4ea70bcd461f5176867dcd89d372386 lib/request/basicauthhandler.py
b23163d485e0dbc038cbf1ba80be11da lib/request/basic.py bd4b654767eab19cd4dcd4520a68eed5 lib/request/basic.py
fc25d951217077fe655ed2a3a81552ae lib/request/comparison.py fc25d951217077fe655ed2a3a81552ae lib/request/comparison.py
1ffa945c2f907b85a3ece90fb3c60d4f lib/request/connect.py e6792ea3cdbcbe17a7fa8cf856d2b956 lib/request/connect.py
43005bd6a78e9cf0f3ed2283a1cb122e lib/request/direct.py 43005bd6a78e9cf0f3ed2283a1cb122e lib/request/direct.py
2b7509ba38a667c61cefff036ec4ca6f lib/request/dns.py 2b7509ba38a667c61cefff036ec4ca6f lib/request/dns.py
ceac6b3bf1f726f8ff43c6814e9d7281 lib/request/httpshandler.py ceac6b3bf1f726f8ff43c6814e9d7281 lib/request/httpshandler.py
@ -101,7 +101,7 @@ fb6be55d21a70765e35549af2484f762 lib/techniques/error/__init__.py
fb6be55d21a70765e35549af2484f762 lib/techniques/__init__.py fb6be55d21a70765e35549af2484f762 lib/techniques/__init__.py
fb6be55d21a70765e35549af2484f762 lib/techniques/union/__init__.py fb6be55d21a70765e35549af2484f762 lib/techniques/union/__init__.py
54d077ef49056031fe746bcc53b1f081 lib/techniques/union/test.py 54d077ef49056031fe746bcc53b1f081 lib/techniques/union/test.py
e141fb96f2a136bafd6bb2350f02d33b lib/techniques/union/use.py 664f79ca6397e880aee143fff721fa67 lib/techniques/union/use.py
8e9ddc7220f6beda89cc45c65e51e72b lib/utils/api.py 8e9ddc7220f6beda89cc45c65e51e72b lib/utils/api.py
544dee96e782560fe4355cbf6ee19b8c lib/utils/brute.py 544dee96e782560fe4355cbf6ee19b8c lib/utils/brute.py
b27421eb57cea711050135f84be99258 lib/utils/crawler.py b27421eb57cea711050135f84be99258 lib/utils/crawler.py
@ -358,8 +358,8 @@ d41d8cd98f00b204e9800998ecf8427e thirdparty/magic/__init__.py
bf318e0abbe6b2e1a167a233db7f744f thirdparty/magic/magic.py bf318e0abbe6b2e1a167a233db7f744f thirdparty/magic/magic.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/multipart/__init__.py d41d8cd98f00b204e9800998ecf8427e thirdparty/multipart/__init__.py
82432cb4ef575aa16900ba221cc1dc98 thirdparty/multipart/multipartpost.py 82432cb4ef575aa16900ba221cc1dc98 thirdparty/multipart/multipartpost.py
3e502b04f3849afbb7f0e13b5fd2b5c1 thirdparty/odict/__init__.py 0a0a5f8f5519cf9dd2c5120f62aabe83 thirdparty/odict/__init__.py
74048dca0470bc78af73f0aafccfd069 thirdparty/odict/odict.py 8d8f91e1d87cb301fdb50db79dfe4d48 thirdparty/odict/ordereddict.py
0105f1734f326704d2d68839084ca661 thirdparty/oset/_abc.py 0105f1734f326704d2d68839084ca661 thirdparty/oset/_abc.py
54a861de0f08bb80c2e8846579ec83bd thirdparty/oset/__init__.py 54a861de0f08bb80c2e8846579ec83bd thirdparty/oset/__init__.py
6c79e6d14e031beebe6de127b53c7c93 thirdparty/oset/pyoset.py 6c79e6d14e031beebe6de127b53c7c93 thirdparty/oset/pyoset.py