同步操作将从 yeqingchen1/sqlmap 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python"""Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)See the file 'LICENSE' for copying permission"""from __future__ import divisionimport timefrom lib.core.common import dataToStdoutfrom lib.core.convert import getUnicodefrom lib.core.data import conffrom lib.core.data import kbclass ProgressBar(object):"""This class defines methods to update and draw a progress bar"""def __init__(self, minValue=0, maxValue=10, totalWidth=None):self._progBar = "[]"self._min = int(minValue)self._max = int(maxValue)self._span = max(self._max - self._min, 0.001)self._width = totalWidth if totalWidth else conf.progressWidthself._amount = 0self._start = Noneself.update()def _convertSeconds(self, value):seconds = valueminutes = seconds // 60seconds = seconds - (minutes * 60)return "%.2d:%.2d" % (minutes, seconds)def update(self, newAmount=0):"""This method updates the progress bar"""if newAmount < self._min:newAmount = self._minelif newAmount > self._max:newAmount = self._maxself._amount = newAmount# Figure out the new percent done, round to an integerdiffFromMin = float(self._amount - self._min)percentDone = (diffFromMin / float(self._span)) * 100.0percentDone = round(percentDone)percentDone = min(100, int(percentDone))# Figure out how many hash bars the percentage should beallFull = self._width - len("100%% [] %s/%s (ETA 00:00)" % (self._max, self._max))numHashes = (percentDone / 100.0) * allFullnumHashes = int(round(numHashes))# Build a progress bar with an arrow of equal signsif numHashes == 0:self._progBar = "[>%s]" % (" " * (allFull - 1))elif numHashes == allFull:self._progBar = "[%s]" % ("=" * allFull)else:self._progBar = "[%s>%s]" % ("=" * (numHashes - 1), " " * (allFull - numHashes))# Add the percentage at the beginning of the progress barpercentString = getUnicode(percentDone) + "%"self._progBar = "%s %s" % (percentString, self._progBar)def progress(self, newAmount):"""This method saves item delta time and shows updated progress bar with calculated eta"""if self._start is None or newAmount > self._max:self._start = time.time()eta = Noneelse:delta = time.time() - self._starteta = (self._max - self._min) * (1.0 * delta / newAmount) - deltaself.update(newAmount)self.draw(eta)def draw(self, eta=None):"""This method draws the progress bar if it has changed"""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 = Falseelse:dataToStdout("\n")def __str__(self):"""This method returns the progress bar string"""return getUnicode(self._progBar)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。