More drei stuff

This commit is contained in:
Miroslav Stampar 2019-05-02 10:22:44 +02:00
parent d465007dfe
commit 6dbf24531c
8 changed files with 15 additions and 15 deletions

View File

@ -75,7 +75,7 @@ def setHandler():
(DBMS.INFORMIX, INFORMIX_ALIASES, InformixMap, InformixConn), (DBMS.INFORMIX, INFORMIX_ALIASES, InformixMap, InformixConn),
] ]
_ = max(_ if (conf.get("dbms") or Backend.getIdentifiedDbms() or kb.heuristicExtendedDbms or "").lower() in _[1] else "" for _ in items) or None _ = max(_ if (conf.get("dbms") or Backend.getIdentifiedDbms() or kb.heuristicExtendedDbms or "").lower() in _[1] else () for _ in items)
if _: if _:
items.remove(_) items.remove(_)
items.insert(0, _) items.insert(0, _)

View File

@ -34,7 +34,7 @@ def _size_of(object_):
if isinstance(object_, dict): if isinstance(object_, dict):
retval += sum(_size_of(_) for _ in itertools.chain.from_iterable(object_.items())) retval += sum(_size_of(_) for _ in itertools.chain.from_iterable(object_.items()))
elif hasattr(object_, "__iter__"): elif hasattr(object_, "__iter__"):
retval += sum(_size_of(_) for _ in object_) retval += sum(_size_of(_) for _ in object_ if _ != object_)
return retval return retval
@ -55,7 +55,7 @@ class BigArray(list):
def __init__(self, items=[]): def __init__(self, items=[]):
self.chunks = [[]] self.chunks = [[]]
self.chunk_length = sys.maxint self.chunk_length = sys.maxsize
self.cache = None self.cache = None
self.filenames = set() self.filenames = set()
self._os_remove = os.remove self._os_remove = os.remove
@ -67,7 +67,7 @@ class BigArray(list):
def append(self, value): def append(self, value):
self.chunks[-1].append(value) self.chunks[-1].append(value)
if self.chunk_length == sys.maxint: if self.chunk_length == sys.maxsize:
self._size_counter += _size_of(value) self._size_counter += _size_of(value)
if self._size_counter >= BIGARRAY_CHUNK_SIZE: if self._size_counter >= BIGARRAY_CHUNK_SIZE:
self.chunk_length = len(self.chunks[-1]) self.chunk_length = len(self.chunks[-1])

View File

@ -17,7 +17,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.5.0" VERSION = "1.3.5.1"
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

@ -1349,6 +1349,9 @@ class Connect(object):
kb.permissionFlag = True kb.permissionFlag = True
singleTimeWarnMessage("potential permission problems detected ('%s')" % message) singleTimeWarnMessage("potential permission problems detected ('%s')" % message)
if not hasattr(headers, "headers"):
headers.headers = ["%s: %s\r\n" % (header, headers[header]) for header in headers]
if content or response: if content or response:
return page, headers, code return page, headers, code

View File

@ -168,7 +168,7 @@ def _unionPosition(comment, place, parameter, prefix, suffix, count, where=PAYLO
validPayload = None validPayload = None
vector = None vector = None
positions = range(0, count) positions = [_ for _ in xrange(0, count)]
# Unbiased approach for searching appropriate usable column # Unbiased approach for searching appropriate usable column
random.shuffle(positions) random.shuffle(positions)

View File

@ -8,6 +8,7 @@ See the file 'LICENSE' for copying permission
import binascii import binascii
from lib.core.common import Backend from lib.core.common import Backend
from lib.core.common import getBytes
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.data import logger from lib.core.data import logger
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
@ -67,7 +68,7 @@ class Takeover(GenericTakeover):
raise SqlmapUnsupportedFeatureException(errMsg) raise SqlmapUnsupportedFeatureException(errMsg)
shellcodeChar = "" shellcodeChar = ""
hexStr = binascii.hexlify(self.shellcodeString[:-1]) hexStr = binascii.hexlify(getBytes(self.shellcodeString[:-1]))
for hexPair in xrange(0, len(hexStr), 2): for hexPair in xrange(0, len(hexStr), 2):
shellcodeChar += "CHAR(0x%s)+" % hexStr[hexPair:hexPair + 2] shellcodeChar += "CHAR(0x%s)+" % hexStr[hexPair:hexPair + 2]

View File

@ -7,7 +7,8 @@ See the file 'LICENSE' for copying permission
import binascii import binascii
from lib.core.convert import utf8encode from lib.core.common import getBytes
from lib.core.common import getUnicode
from plugins.generic.syntax import Syntax as GenericSyntax from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax): class Syntax(GenericSyntax):
@ -19,11 +20,6 @@ class Syntax(GenericSyntax):
""" """
def escaper(value): def escaper(value):
retVal = None return "0x%s" % getUnicode(binascii.hexlify(getBytes(value)))
try:
retVal = "0x%s" % binascii.hexlify(value)
except UnicodeEncodeError:
retVal = "CONVERT(0x%s USING utf8)" % "".join("%.2x" % ord(_) for _ in utf8encode(value))
return retVal
return Syntax._escape(expression, quote, escaper) return Syntax._escape(expression, quote, escaper)

View File

@ -292,7 +292,7 @@ def isstringlike(x):
def choose_boundary(): def choose_boundary():
"""Return a string usable as a multipart boundary.""" """Return a string usable as a multipart boundary."""
# follow IE and firefox # follow IE and firefox
nonce = "".join([str(random.randint(0, sys.maxint-1)) for i in (0,1,2)]) nonce = "".join([str(random.randint(0, sys.maxsize-1)) for i in (0,1,2)])
return "-"*27 + nonce return "-"*27 + nonce
# This cut-n-pasted MimeWriter from standard library is here so can add # This cut-n-pasted MimeWriter from standard library is here so can add