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

Skip to content

Commit 430a254

Browse files
committed
fixed that thread partial output problem (one character behind) reported by Kasper Fons
1 parent 74860fe commit 430a254

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

lib/techniques/blind/inference.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def etaProgressUpdate(charTime, index):
194194
index = [ firstChar ] # As list for python nested function scoping
195195
idxlock = threading.Lock()
196196
iolock = threading.Lock()
197+
valuelock = threading.Lock()
197198
conf.seqLock = threading.Lock()
198199
conf.threadContinue = True
199200

@@ -220,7 +221,10 @@ def downloadThread():
220221
else:
221222
break
222223

224+
valuelock.acquire()
223225
value[curidx-1] = val
226+
currentValue = list(value)
227+
valuelock.release()
224228

225229
if conf.threadContinue:
226230
if showEta:
@@ -230,7 +234,7 @@ def downloadThread():
230234
endCharIndex = 0
231235

232236
for i in xrange(length):
233-
if value[i] is not None:
237+
if currentValue[i] is not None:
234238
endCharIndex = max(endCharIndex, i)
235239

236240
output = ''
@@ -240,11 +244,11 @@ def downloadThread():
240244

241245
count = 0
242246

243-
for i in xrange(startCharIndex, endCharIndex):
244-
output += '_' if value[i] is None else value[i]
247+
for i in xrange(startCharIndex, endCharIndex + 1):
248+
output += '_' if currentValue[i] is None else currentValue[i]
245249

246250
for i in xrange(length):
247-
count += 1 if value[i] is not None else 0
251+
count += 1 if currentValue[i] is not None else 0
248252

249253
if startCharIndex > 0:
250254
output = '..' + output[2:]

0 commit comments

Comments
 (0)