mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 19:55:47 +03:00
Fixes #3165
This commit is contained in:
parent
4ecf6eee05
commit
b44551230e
|
@ -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.2.7.6"
|
||||
VERSION = "1.2.7.7"
|
||||
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)
|
||||
|
|
|
@ -485,7 +485,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
|
||||
if kb.threadContinue:
|
||||
if showEta:
|
||||
progress.progress(calculateDeltaSeconds(start), threadData.shared.index[0])
|
||||
progress.progress(threadData.shared.index[0])
|
||||
elif conf.verbose >= 1:
|
||||
startCharIndex = 0
|
||||
endCharIndex = 0
|
||||
|
@ -578,7 +578,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
# Did we have luck?
|
||||
if result:
|
||||
if showEta:
|
||||
progress.progress(calculateDeltaSeconds(start), len(commonValue))
|
||||
progress.progress(len(commonValue))
|
||||
elif conf.verbose in (1, 2) or conf.api:
|
||||
dataToStdout(filterControlChars(commonValue[index - 1:]))
|
||||
|
||||
|
@ -628,7 +628,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
threadData.shared.value = partialValue = partialValue + val
|
||||
|
||||
if showEta:
|
||||
progress.progress(calculateDeltaSeconds(start), index)
|
||||
progress.progress(index)
|
||||
elif conf.verbose in (1, 2) or conf.api:
|
||||
dataToStdout(filterControlChars(val))
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ def errorUse(expression, dump=False):
|
|||
with kb.locks.value:
|
||||
index = None
|
||||
if threadData.shared.showEta:
|
||||
threadData.shared.progress.progress(time.time() - valueStart, threadData.shared.counter)
|
||||
threadData.shared.progress.progress(threadData.shared.counter)
|
||||
for index in xrange(1 + len(threadData.shared.buffered)):
|
||||
if index < len(threadData.shared.buffered) and threadData.shared.buffered[index][0] >= num:
|
||||
break
|
||||
|
|
|
@ -333,7 +333,7 @@ def unionUse(expression, unpack=True, dump=False):
|
|||
items = parseUnionPage(output)
|
||||
|
||||
if threadData.shared.showEta:
|
||||
threadData.shared.progress.progress(time.time() - valueStart, threadData.shared.counter)
|
||||
threadData.shared.progress.progress(threadData.shared.counter)
|
||||
if isListLike(items):
|
||||
# in case that we requested N columns and we get M!=N then we have to filter a bit
|
||||
if len(items) > 1 and len(expressionFieldsList) > 1:
|
||||
|
@ -355,7 +355,7 @@ def unionUse(expression, unpack=True, dump=False):
|
|||
else:
|
||||
index = None
|
||||
if threadData.shared.showEta:
|
||||
threadData.shared.progress.progress(time.time() - valueStart, threadData.shared.counter)
|
||||
threadData.shared.progress.progress(threadData.shared.counter)
|
||||
for index in xrange(1 + len(threadData.shared.buffered)):
|
||||
if index < len(threadData.shared.buffered) and threadData.shared.buffered[index][0] >= num:
|
||||
break
|
||||
|
|
|
@ -5,6 +5,8 @@ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
|
|||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import time
|
||||
|
||||
from lib.core.common import getUnicode
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.data import conf
|
||||
|
@ -17,13 +19,12 @@ class ProgressBar(object):
|
|||
|
||||
def __init__(self, minValue=0, maxValue=10, totalWidth=None):
|
||||
self._progBar = "[]"
|
||||
self._oldProgBar = ""
|
||||
self._min = int(minValue)
|
||||
self._max = int(maxValue)
|
||||
self._span = max(self._max - self._min, 0.001)
|
||||
self._width = totalWidth if totalWidth else conf.progressWidth
|
||||
self._amount = 0
|
||||
self._times = []
|
||||
self._start = None
|
||||
self.update()
|
||||
|
||||
def _convertSeconds(self, value):
|
||||
|
@ -52,7 +53,7 @@ class ProgressBar(object):
|
|||
percentDone = min(100, int(percentDone))
|
||||
|
||||
# Figure out how many hash bars the percentage should be
|
||||
allFull = self._width - len("100%% [] %s/%s ETA 00:00" % (self._max, self._max))
|
||||
allFull = self._width - len("100%% [] %s/%s (ETA 00:00)" % (self._max, self._max))
|
||||
numHashes = (percentDone / 100.0) * allFull
|
||||
numHashes = int(round(numHashes))
|
||||
|
||||
|
@ -68,19 +69,18 @@ class ProgressBar(object):
|
|||
percentString = getUnicode(percentDone) + "%"
|
||||
self._progBar = "%s %s" % (percentString, self._progBar)
|
||||
|
||||
def progress(self, deltaTime, newAmount):
|
||||
def progress(self, newAmount):
|
||||
"""
|
||||
This method saves item delta time and shows updated progress bar with calculated eta
|
||||
"""
|
||||
|
||||
if len(self._times) <= ((self._max * 3) / 100) or newAmount > self._max:
|
||||
if self._start is None or newAmount > self._max:
|
||||
self._start = time.time()
|
||||
eta = None
|
||||
else:
|
||||
midTime = sum(self._times) / len(self._times)
|
||||
midTimeWithLatest = (midTime + deltaTime) / 2
|
||||
eta = midTimeWithLatest * (self._max - newAmount)
|
||||
delta = time.time() - self._start
|
||||
eta = (self._max - self._min) * (1.0 * delta / newAmount) - delta
|
||||
|
||||
self._times.append(deltaTime)
|
||||
self.update(newAmount)
|
||||
self.draw(eta)
|
||||
|
||||
|
@ -89,15 +89,13 @@ class ProgressBar(object):
|
|||
This method draws the progress bar if it has changed
|
||||
"""
|
||||
|
||||
if self._progBar != self._oldProgBar:
|
||||
self._oldProgBar = self._progBar
|
||||
dataToStdout("\r%s %d/%d%s" % (self._progBar, self._amount, self._max, (" ETA %s" % self._convertSeconds(int(eta))) if eta is not None else ""))
|
||||
if self._amount >= self._max:
|
||||
if not conf.liveTest:
|
||||
dataToStdout("\r%s\r" % (" " * self._width))
|
||||
kb.prependFlag = False
|
||||
else:
|
||||
dataToStdout("\n")
|
||||
dataToStdout("\r%s %d/%d%s" % (self._progBar, self._amount, self._max, (" (ETA %s)" % (self._convertSeconds(int(eta)) if eta is not None else "??:??"))))
|
||||
if self._amount >= self._max:
|
||||
if not conf.liveTest:
|
||||
dataToStdout("\r%s\r" % (" " * self._width))
|
||||
kb.prependFlag = False
|
||||
else:
|
||||
dataToStdout("\n")
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
|
|
@ -48,7 +48,7 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
|
|||
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
|
||||
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
|
||||
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
|
||||
f1e0cc7708df13f9f973dbcabfd77007 lib/core/settings.py
|
||||
c4439324bd9484f4a35d648a20d7bf87 lib/core/settings.py
|
||||
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
|
||||
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
|
||||
95f04c1c1d8c3998d86e1bdf0e12771c lib/core/target.py
|
||||
|
@ -89,17 +89,17 @@ fb9e34d558293b5d6b9727f440712886 lib/takeover/registry.py
|
|||
48575dde7bb867b7937769f569a98309 lib/takeover/udf.py
|
||||
f6f835e4190a55e42d13c1e7ca3f728f lib/takeover/web.py
|
||||
f1decf0a987bd3a4bc757212cbe6a6c8 lib/takeover/xp_cmdshell.py
|
||||
4a7f231e597f754e9fcd116d13ad1a4d lib/techniques/blind/inference.py
|
||||
09beb19c2ec9fdd14329f1c0b59a2d05 lib/techniques/blind/inference.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/blind/__init__.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/dns/__init__.py
|
||||
799faf9008527d2e9da9d923e50f685a lib/techniques/dns/test.py
|
||||
48a24f48da791e67309003fd5e8428cb lib/techniques/dns/use.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/error/__init__.py
|
||||
f5fb02487edaf9adaa81d54324c84f8f lib/techniques/error/use.py
|
||||
b9f6148c8df6b9d3316ce082dc1a63dd lib/techniques/error/use.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/__init__.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/techniques/union/__init__.py
|
||||
94d7a22bb6725a91e84ba2cd9973e96d lib/techniques/union/test.py
|
||||
11ecf2effbe9f40b361843d546c3c521 lib/techniques/union/use.py
|
||||
8b770864bdb106ef50c70173c824395c lib/techniques/union/use.py
|
||||
77ff35587af9e3dfde63b8327e230f9a lib/utils/api.py
|
||||
37dfb641358669f62c2acedff241348b lib/utils/brute.py
|
||||
31b1e7eb489eac837db6a2bc1dcb7da7 lib/utils/crawler.py
|
||||
|
@ -111,7 +111,7 @@ cc1cfe36057f1d9bbdcba1bcc03359f9 lib/utils/hash.py
|
|||
011d2dbf589e0faa0deca61a651239cc lib/utils/htmlentities.py
|
||||
1e5532ede194ac9c083891c2f02bca93 lib/utils/__init__.py
|
||||
010d8327239d33af4ce9f25683cfc012 lib/utils/pivotdumptable.py
|
||||
5cb78b0e60fd7fd84502d62cf85d2064 lib/utils/progress.py
|
||||
683c3bd05b6164f56a57ed495c162684 lib/utils/progress.py
|
||||
0ec5cec9d93d5ffd1eaeda6e942ecadf lib/utils/purge.py
|
||||
2c5a655c8e94cbe2664ee497752ac1f2 lib/utils/search.py
|
||||
571884f530796534f03c49cf3f380a4c lib/utils/sqlalchemy.py
|
||||
|
|
Loading…
Reference in New Issue
Block a user