One more 2to3 baby step

This commit is contained in:
Miroslav Stampar
2019-01-22 02:29:52 +01:00
parent 7074365f8e
commit 2c270ed250
10 changed files with 20 additions and 20 deletions

View File

@@ -148,7 +148,7 @@ class BigArray(list):
if y < 0:
y += len(self)
index = y / self.chunk_length
index = y // self.chunk_length
offset = y % self.chunk_length
chunk = self.chunks[index]
@@ -159,7 +159,7 @@ class BigArray(list):
return self.cache.data[offset]
def __setitem__(self, y, value):
index = y / self.chunk_length
index = y // self.chunk_length
offset = y % self.chunk_length
chunk = self.chunks[index]

View File

@@ -2129,7 +2129,7 @@ def average(values):
0.9
"""
return (sum(values) / len(values)) if values else None
return (1.0 * sum(values) / len(values)) if values else None
@cachedmethod
def stdev(values):
@@ -3555,7 +3555,7 @@ def removeReflectiveValues(content, payload, suppressWarning=False):
retVal = content.replace(payload, REFLECTED_VALUE_MARKER) # dummy approach
if len(parts) > REFLECTED_MAX_REGEX_PARTS: # preventing CPU hogs
regex = _("%s%s%s" % (REFLECTED_REPLACEMENT_REGEX.join(parts[:REFLECTED_MAX_REGEX_PARTS / 2]), REFLECTED_REPLACEMENT_REGEX, REFLECTED_REPLACEMENT_REGEX.join(parts[-REFLECTED_MAX_REGEX_PARTS / 2:])))
regex = _("%s%s%s" % (REFLECTED_REPLACEMENT_REGEX.join(parts[:REFLECTED_MAX_REGEX_PARTS // 2]), REFLECTED_REPLACEMENT_REGEX, REFLECTED_REPLACEMENT_REGEX.join(parts[-REFLECTED_MAX_REGEX_PARTS // 2:])))
parts = filter(None, regex.split(REFLECTED_REPLACEMENT_REGEX))

View File

@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.1.63"
VERSION = "1.3.1.64"
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)

View File

@@ -621,7 +621,7 @@ class Metasploit:
payloadSize = int(match.group(2))
if extra == "BufferRegister=EAX":
payloadSize = payloadSize / 2
payloadSize = payloadSize // 2
debugMsg = "the shellcode size is %d bytes" % payloadSize
logger.debug(debugMsg)

View File

@@ -57,7 +57,7 @@ def dnsUse(payload, expression):
while True:
count += 1
prefix, suffix = ("%s" % randomStr(length=3, alphabet=DNS_BOUNDARIES_ALPHABET) for _ in xrange(2))
chunk_length = MAX_DNS_LABEL / 2 if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.MYSQL, DBMS.PGSQL) else MAX_DNS_LABEL / 4 - 2
chunk_length = MAX_DNS_LABEL // 2 if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.MYSQL, DBMS.PGSQL) else MAX_DNS_LABEL // 4 - 2
_, _, _, _, _, _, fieldToCastStr, _ = agent.getFields(expression)
nulledCastedField = agent.nullAndCastField(fieldToCastStr)
extendedField = re.search(r"[^ ,]*%s[^ ,]*" % re.escape(fieldToCastStr), expression).group(0)

View File

@@ -94,7 +94,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
candidate = len(result) - len(kb.chars.stop)
current = candidate if candidate != current else current - 1
else:
current = current / 2
current = current // 2
if kb.errorChunkLength:
hashDBWrite(HASHDB_KEYS.KB_ERROR_CHUNK_LENGTH, kb.errorChunkLength)

View File

@@ -74,7 +74,7 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
highCols += ORDER_BY_STEP
else:
while not found:
mid = highCols - (highCols - lowCols) / 2
mid = highCols - (highCols - lowCols) // 2
if _orderByTest(mid):
lowCols = mid
else:

View File

@@ -29,7 +29,7 @@ class ProgressBar(object):
def _convertSeconds(self, value):
seconds = value
minutes = seconds / 60
minutes = seconds // 60
seconds = seconds - (minutes * 60)
return "%.2d:%.2d" % (minutes, seconds)

View File

@@ -58,7 +58,7 @@ class xrange(object):
return self._len()
def _len(self):
return max(0, int((self.stop - self.start) / self.step))
return max(0, int((self.stop - self.start) // self.step))
def __contains__(self, value):
return (self.start <= value < self.stop) and (value - self.start) % self.step == 0