Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ec0428

Browse files
committed
minor adjustments
1 parent fffda32 commit 7ec0428

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,7 @@ def __setConfAttributes():
953953
conf.paramNegative = False
954954
conf.path = None
955955
conf.port = None
956+
conf.progressWidth = 54
956957
conf.retriesCount = 0
957958
conf.scheme = None
958959
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")

lib/core/progress.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,20 @@
2323
"""
2424

2525
from lib.core.common import dataToStdout
26+
from lib.core.data import conf
2627

2728
class ProgressBar:
2829
"""
2930
This class defines methods to update and draw a progress bar
3031
"""
3132

32-
def __init__(self, minValue=0, maxValue=10, totalWidth=54):
33+
def __init__(self, minValue=0, maxValue=10, totalWidth=None):
3334
self.__progBar = "[]"
3435
self.__oldProgBar = ""
3536
self.__min = int(minValue)
3637
self.__max = int(maxValue)
3738
self.__span = self.__max - self.__min
38-
self.__width = totalWidth
39+
self.__width = totalWidth if totalWidth else conf.progressWidth
3940
self.__amount = 0
4041
self.update()
4142

lib/techniques/blind/inference.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
9595
showEta = conf.eta and isinstance(length, int)
9696
numThreads = min(conf.threads, length)
9797
threads = []
98-
totalWidth = 54
9998

10099
if showEta:
101100
progress = ProgressBar(maxValue=length)
@@ -106,7 +105,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
106105
infoMsg = "starting %d threads" % numThreads
107106
logger.info(infoMsg)
108107

109-
dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, totalWidth)))
108+
dataToStdout("[%s] [INFO] retrieved: %s" % (time.strftime("%X"), "_" * min(length, conf.progressWidth)))
110109
dataToStdout("\r[%s] [INFO] retrieved: " % time.strftime("%X"))
111110
else:
112111
dataToStdout("[%s] [INFO] retrieved: " % time.strftime("%X"))
@@ -191,16 +190,16 @@ def downloadThread():
191190
if value[i] is not None:
192191
endCharIndex = max(endCharIndex, i)
193192
output = ''
194-
if endCharIndex > totalWidth:
195-
startCharIndex = endCharIndex - totalWidth
193+
if endCharIndex > conf.progressWidth:
194+
startCharIndex = endCharIndex - conf.progressWidth
196195
count = 0
197196
for i in xrange(startCharIndex, endCharIndex):
198197
output += '_' if value[i] is None else value[i]
199198
for i in xrange(length):
200199
count += 1 if value[i] is not None else 0
201200
if startCharIndex > 0:
202201
output = '...' + output[3:]
203-
if endCharIndex - startCharIndex == totalWidth:
202+
if endCharIndex - startCharIndex == conf.progressWidth:
204203
output = output[:-3] + '...'
205204
status = ' %d/%d' % (count, length)
206205
output += status if count != length else " "*len(status)

0 commit comments

Comments
 (0)