Skip to content

Commit 91dd609

Browse files
committed
fixed threading bug (difflib :)
1 parent 6712b19 commit 91dd609

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ def __setConfAttributes():
957957
conf.scheme = None
958958
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")
959959
conf.seqMatcher = difflib.SequenceMatcher(None)
960+
conf.seqLock = None
960961
conf.sessionFP = None
961962
conf.start = True
962963
conf.threadException = False

lib/request/comparison.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ def comparison(page, headers=None, getSeqMatcher=False):
6565
else:
6666
return False
6767

68+
if conf.seqLock:
69+
conf.seqLock.acquire()
70+
6871
conf.seqMatcher.set_seq2(page)
6972
ratio = round(conf.seqMatcher.ratio(), 3)
7073

74+
if conf.seqLock:
75+
conf.seqLock.release()
76+
7177
# If the url is stable and we did not set yet the match ratio and the
7278
# current injected value changes the url page content
7379
if conf.matchRatio is None:

lib/techniques/blind/inference.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def etaProgressUpdate(charTime, index):
153153
index = [ firstChar ] # As list for python nested function scoping
154154
idxlock = threading.Lock()
155155
iolock = threading.Lock()
156+
conf.seqLock = threading.Lock()
156157

157158
def downloadThread():
158159
try:
@@ -237,6 +238,7 @@ def downloadThread():
237238
if conf.verbose >= 1 and not showEta and infoMsg:
238239
dataToStdout(infoMsg)
239240

241+
conf.seqLock = None
240242
else:
241243
index = firstChar
242244

0 commit comments

Comments
 (0)